Skip to content

shell/app: Correctly track the window used for the fallback icon

Benjamin Berg requested to merge benzea/fix-shell-app-fallback-icon into main

So, had a random crash in on_window_icon_changed. It turned out, that the ShellApp had a ref_count of 0. i.e. destroyed ShellApp and window still fired the event, suggesting the signal was not disconnected. I also found a GLib warning that we tried to disconnect a signal from the wrong object. As such, I think this patch fixes the issue (however, I have only compile tested it, and I am not sure how to reproduce it!).

We were not properly tracking the window used for the fallback icon. This could trigger a crash, as disconnection of the signal handler might happen on the wrong window, which in turn could cause the icon change notification to happen on a destroyed ShellApp instance.

Fix this by tracking the window used for the fallback icon. Disconnect the icon notify callback explicitly for this window only when it is removed.

Also, just to be extra safe, make sure that the icon is never NULL even if x11_window_create_fallback_gicon should return NULL for some reason.

Merge request reports