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 638580 - 'application' window's property released too late
'application' window's property released too late
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkApplication
2.91.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-01-03 15:58 UTC by Pavel Holejsovsky
Modified: 2011-01-03 18:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Move gtk_window_release_application() call from finalize to gtk_window_destroy(). (1.39 KB, patch)
2011-01-03 16:01 UTC, Pavel Holejsovsky
none Details | Review

Description Pavel Holejsovsky 2011-01-03 15:58:14 UTC
Currently GtkWindow auto-releases 'application' in window's finalize method; this causes problems for higher-language bindings, which tend to store its own reference to toplevel window objects.  This forces higher-level languages to have some code like this (Lua pseudocode):

function window_instance:on_destroy()
    window_instance.application = nil
end

i.e. creating 'destroy' signal handler which unsets window's 'application' property (and thus actually allows application to terminate GApplication.run() loop).
Comment 1 Pavel Holejsovsky 2011-01-03 16:01:14 UTC
Created attachment 177413 [details] [review]
Move gtk_window_release_application() call from finalize to gtk_window_destroy().

Releases GtkWindow's 'application' property in window_destroy instead of finalize.

I'm not sure whether the call to gtk_window_release_application() should also remain in finalize method, but I can't come up with case how the window could be destroyed without gtk_window_destroy() being called.
Comment 2 Allison Karlitskaya (desrt) 2011-01-03 17:49:50 UTC
I think I would prefer for the release call in finalize() to remain.  If not, then setting the 'application' property on an already-destroyed window will leak the application when the window is finally finalized.

Otherwise it seems okay.