Skip to content

XfwWnckIcon: Silently return NULL if no X11 window can be found

If _xfw_wnck_object_get_x11_window() should not return None, it would be up to it to issue a warning rather than the calling function. But in this case it can return None because WnckClassGroup can emit the "icon-changed" signal when its window list is empty.

This sometimes happens with the panel tasklist when closing the last window of a group (reproducible for example with gitk). The signal emitted in this trace is WnckClassGroup::icon-changed:

** (lxfce4-panel:111715): CRITICAL **: 17:26:14.870: xfw_wnck_object_get_net_wm_icon: assertion 'xid != None' failed

Thread 1 "lxfce4-panel" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6fa28e5 in g_logv () from /usr/lib/
#0  0x00007ffff6fa28e5 in g_logv () at /usr/lib/
#1  0x00007ffff6fa2b64 in g_log () at /usr/lib/
#2  0x00007ffff7d4a65a in xfw_wnck_object_get_net_wm_icon (wnck_object=wnck_object@entry=0x555555915440) at xfw-wnck-icon.c:390
#3  0x00007ffff7d4ae18 in xfw_wnck_icon_initable_real_init (initable=<optimized out>, cancellable=<optimized out>, error=0x0) at xfw-wnck-icon.c:244
#4  0x00007ffff71577a7 in g_initable_new_valist () at /usr/lib/
#5  0x00007ffff715789e in g_initable_new () at /usr/lib/
#6  0x00007ffff7d4b558 in _xfw_wnck_icon_new (wnck_object=<optimized out>) at xfw-wnck-icon.c:677
#7  0x00007ffff7d4163f in _xfw_wnck_object_get_gicon (wnck_object=0x555555915440, primary_icon_name=0x0, secondary_icon_name=0x0, fallback_icon_name=0x7ffff7d522d8 "application-x-executable-symbolic") at libxfce4windowing-private.c:85
#8  0x00007ffff7d41cec in xfw_application_get_gicon (app=app@entry=0x555555bb80d0) at xfw-application.c:308
#9  0x00007ffff7d41d77 in xfw_application_get_icon (app=app@entry=0x555555bb80d0, size=size@entry=24, scale=scale@entry=1) at xfw-application.c:274
#10 0x00007ffff0e97c9a in xfce_tasklist_group_button_icon_changed (app=0x555555bb80d0, group_child=0x7fffe4036990) at tasklist-widget.c:4220
#11 0x00007ffff7097210 in g_closure_invoke () at /usr/lib/
#12 0x00007ffff70c4ea8 in  () at /usr/lib/
#13 0x00007ffff70b4f75 in g_signal_emit_valist () at /usr/lib/
#14 0x00007ffff70b5424 in g_signal_emit_by_name () at /usr/lib/
#15 0x00007ffff70b511c in g_signal_emit_valist () at /usr/lib/
#16 0x00007ffff70b5204 in g_signal_emit () at /usr/lib/
#17 0x00007ffff7f08335 in  () at /usr/lib/
#18 0x00007ffff7f09888 in  () at /usr/lib/
#19 0x00007ffff6f9987b in g_main_context_dispatch () at /usr/lib/
#20 0x00007ffff6ff0c89 in  () at /usr/lib/
#21 0x00007ffff6f98ddf in g_main_loop_run () at /usr/lib/
#22 0x00007ffff75d8eef in gtk_main () at /usr/lib/
#23 0x000055555556a1f1 in main (argc=<optimized out>, argv=<optimized out>) at main.c:387

I actually think this happens because the panel keeps references to XfwApplication that it doesn't release as fast as it should (this is from before the switch from wnck to xfw), so maybe it could be avoided in this case, but anyway it shows that it can happen.

I opened a MR because maybe you want to fix it some other way @kelnos?

Merge request reports