#2727 closed defect (fixed)
corrupted/missing window icons in Ubuntu launcher
Reported by: | Krzysztof Sachanowicz | Owned by: | Antoine Martin |
---|---|---|---|
Priority: | major | Milestone: | 4.0 |
Component: | client | Version: | 3.0.x |
Keywords: | Cc: |
Description
Client version: Ubuntu 18.04.4 LTS with Unity, Xpra GTK3 X11 client version 3.0.8-r25889 64-bit
It happens quite often (once in a few times), usually when starting Eclipse IDE on server, that window icon shown in launcher is either empty or sometimes corrupted. It even happened that one application (mate-terminal) got an icon of another application, with some corrupted pixels visible. I captured it on screenshots - see attachments.
I've been able to debug it. Here is how I started the client, with a few log lines:
krzysztof@krzysztof-HP-ProBook-4720s:~$ XPRA_SAVE_WINDOW_ICONS=1 xpra attach -d icon ssh/tad-34/2 --ssh=ssh 2020-04-14 10:19:31,200 Xpra GTK3 X11 client version 3.0.8-r25889 64-bit 2020-04-14 10:19:31,455 running on Linux Ubuntu 18.04 bionic 2020-04-14 10:19:31,457 window manager is 'GNOME Shell' 2020-04-14 10:19:34,738 GStreamer version 1.14.5 for Python 3.6.9 64-bit 2020-04-14 10:19:36,789 keyboard settings: rules=evdev, model=pc105, layout=pl,us,pl 2020-04-14 10:19:36,805 desktop size is 1600x900 with 1 screen: 2020-04-14 10:19:36,806 :0.0 (423x238 mm - DPI: 96x96) workarea: 1533x873 at 67x27 2020-04-14 10:19:36,806 LVDS (367x230 mm - DPI: 110x99) Verification code: Password: 2020-04-14 10:19:59,775 enabled remote logging 2020-04-14 10:19:59,777 Xpra GTK3 X11 server version 3.0.6-r25195 64-bit 2020-04-14 10:19:59,778 running on Linux LinuxMint 19.2 tina 2020-04-14 10:19:59,805 Attached to tad-34:22 2020-04-14 10:19:59,805 (press Control-C to detach)
Using XPRA_SAVE_WINDOW_ICONS=1 I noticed that saved icons were correct, so it was not a problem with server sending invalid icons. I realized that when window title changes, the icon usually gets fixed (but not always). I saw in logs that reset_icon()
is called.
I checked affected windows using xprop, to see _NET_WM_ICON. Indeed, icons were invalid. Before that I thought Unity might have a bug - I think xprop proves it is not the case.
After some time of debugging, I focused my attention on get_pixbuf_from_data()
in gtk_common/gtk_util.py
. It calls function GdkPixbuf.Pixbuf.new_from_data()
. It seems this function is not safe to be called from python. See these bug reports:
- https://stackoverflow.com/questions/29501835/gtk3-gdk-pixbuf-new-from-data-gives-segmentation-fault-core-dumped-error-13
- https://bugzilla.gnome.org/show_bug.cgi?id=732297
- https://stackoverflow.com/questions/24062779/how-to-correctly-covert-3d-array-into-continguous-rgb-bytes/24070152
It is recommended to use new_from_bytes()
instead. So I tested the following fix:
diff -ru gtk_common/gtk_util.py gtk_common/gtk_util.py --- gtk_common/gtk_util.py 2019-11-30 13:33:28.000000000 +0100 +++ gtk_common/gtk_util.py 2020-04-08 17:45:16.410738189 +0200 @@ -171,10 +171,10 @@ def get_pixbuf_from_data(rgb_data, has_alpha, w, h, rowstride): - data = array.array('B', strtobytes(rgb_data)) - return GdkPixbuf.Pixbuf.new_from_data(data, GdkPixbuf.Colorspace.RGB, - has_alpha, 8, w, h, rowstride, - None, None) + log("get_pixbuf_from_data: using new_from_bytes, w=%s h=%s", w, h) + data = glib.Bytes(rgb_data) + return GdkPixbuf.Pixbuf.new_from_bytes(data, GdkPixbuf.Colorspace.RGB, + has_alpha, 8, w, h, rowstride) get_pixbuf_from_window = gdk.pixbuf_get_from_window
With this fix, the problem no longer appeared. Every icon is now displayed correctly.
Attachments (4)
Change History (8)
Changed 10 months ago by
Attachment: | where_is_eclipse1.png added |
---|
Changed 10 months ago by
Attachment: | where_is_eclipse2.png added |
---|
Changed 10 months ago by
Attachment: | xpra_saved_icons.png added |
---|
Changed 10 months ago by
Attachment: | xpra_fix_icon_corruption.diff added |
---|
comment:1 Changed 10 months ago by
comment:2 Changed 10 months ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Awesome work, thank you so much!
Applied in r26118. (will backport)
comment:3 Changed 10 months ago by
Found more places where we were using GdkPixbuf.Pixbuf.new_from_data
and switched them over: r26121.
comment:4 Changed 4 days ago by
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2727
Window with blank icon:
The same window, with fixed icon after changing window title a few times: