GNOME Bugzilla – Bug 653053
Avoid GApplication being released twice on gtk_application_remove_window() calls
Last modified: 2011-06-21 13:26:39 UTC
There is a cyclic call to gtk_application_window_removed() that causes g_application_release() to be called twice there. This patch avoids a second call to gtk_application_remove_window() from finding the window and going down the cycle again.
Created attachment 190316 [details] [review] Avoid GApplication being released twice on gtk_application_remove_window() calls Removing the window from the window list before setting the application to %NULL avoids gtk_application_remove_window() triggering another call to gtk_application_window_removed(), which would release the application a second time.
Review of attachment 190316 [details] [review]: If you've tested this it's probably good, but it'd be even nicer to add a private ->in_window_removal gboolean and make things more explicit.
Hm, I am not sure if that's really needed. Theoretically you could have a cascade removal of windows so ->in_window_removal could cause trouble. Removing the window from the list ensures that only *that* particular window won't be /removed/ twice (where /removed/ actually means a double application release).
Review of attachment 190316 [details] [review]: Looks ok to me.
Attachment 190316 [details] pushed as c3b7590 - Avoid GApplication being released twice on gtk_application_remove_window() calls
What about 3.0 and 2.24 branches?
There is no GtkApplication in 2.x. If this problem affects 3.0 too, then sure, feel free to cherry-pick the fix.