[libwnck] core: Fix order of shutting down operations in wnck_shutdown()



commit 46f87fa639a108c2ecd5ed711a530716545b2065
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jan 30 15:36:24 2012 +0100

    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().

 libwnck/util.c |   16 +++++++++++++++-
 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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]