From 46f87fa639a108c2ecd5ed711a530716545b2065 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Mon, 30 Jan 2012 15:36:24 +0100 Subject: 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 file changed, 15 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1