summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2012-01-30 15:36:24 +0100
committerVincent Untz <vuntz@gnome.org>2012-01-30 15:37:31 +0100
commit46f87fa639a108c2ecd5ed711a530716545b2065 (patch)
treeb5f3eb20dd42f9744efb1c52555e88162065c2cd
parent500561512c2b073072206aa70e28590fb04e65bb (diff)
downloadlibwnck-46f87fa639a108c2ecd5ed711a530716545b2065.tar.gz
core: Fix order of shutting down operations in wnck_shutdown()
Due to the way objects are referenced and unreferenced, we also need to be extra careful in the order we shut things down in wnck_shutdown().
-rw-r--r--libwnck/util.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libwnck/util.c b/libwnck/util.c
index 2926fef..1e16862 100644
--- a/libwnck/util.c
+++ b/libwnck/util.c
@@ -808,9 +808,23 @@ void
wnck_shutdown (void)
{
_wnck_event_filter_shutdown ();
- _wnck_screen_shutdown_all ();
+
+ /* Warning: this is hacky :-)
+ *
+ * Shutting down all WnckScreen objects will automatically unreference (and
+ * finalize) all WnckWindow objects, but not the WnckClassGroup and
+ * WnckApplication objects.
+ * Therefore we need to manually shut down all WnckClassGroup and
+ * WnckApplication objects first, since they reference the WnckScreen they're
+ * on.
+ * On the other side, shutting down the WnckScreen objects will results in
+ * all WnckWindow objects getting unreferenced and finalized, and must
+ * actually be done before shutting down global WnckWindow structures
+ * (because the WnckScreen has a list of WnckWindow that will get mis-used
+ * otherwise). */
_wnck_class_group_shutdown_all ();
_wnck_application_shutdown_all ();
+ _wnck_screen_shutdown_all ();
_wnck_window_shutdown_all ();
if (xres_removeid != 0)