After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 653053 - Avoid GApplication being released twice on gtk_application_remove_window() calls
Avoid GApplication being released twice on gtk_application_remove_window() calls
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkApplication
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-06-20 21:38 UTC by Claudio Saavedra
Modified: 2011-06-21 13:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Avoid GApplication being released twice on gtk_application_remove_window() calls (1.11 KB, patch)
2011-06-20 21:38 UTC, Claudio Saavedra
committed Details | Review

Description Claudio Saavedra 2011-06-20 21:38:32 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.
Comment 1 Claudio Saavedra 2011-06-20 21:38:34 UTC
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.
Comment 2 Colin Walters 2011-06-20 21:41:10 UTC
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.
Comment 3 Claudio Saavedra 2011-06-20 22:03:24 UTC
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).
Comment 4 Matthias Clasen 2011-06-20 23:40:06 UTC
Review of attachment 190316 [details] [review]:

Looks ok to me.
Comment 5 Claudio Saavedra 2011-06-21 06:49:37 UTC
Attachment 190316 [details] pushed as c3b7590 - Avoid GApplication being released twice on gtk_application_remove_window() calls
Comment 6 Claudio Saavedra 2011-06-21 06:56:32 UTC
What about 3.0 and 2.24 branches?
Comment 7 Matthias Clasen 2011-06-21 13:26:39 UTC
There is no GtkApplication in 2.x. 
If this problem affects 3.0 too, then sure, feel free to cherry-pick the fix.