[mutter] window: Remove prefs listener in _unmanage instead of _finalize



commit 860c2a628282fec0f7877fb0f85d6f2f6c038650
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Feb 29 22:31:30 2012 +0100

    window: Remove prefs listener in _unmanage instead of _finalize
    
    After _unmanage the object is semantically dead even if technically it's not,
    so remove the prefs listener here to prevent it being called for a dead
    object.
    
    In particular this fixes a crash when starting up gnome-shell with at least
    one gimp utility window opened which causes mutter to create a MetaWindow for
    it only to immediately get an UnmapNotify afterwards which causes mutter to
    unmanage the MetaWindow. Afterwards prefs_changed_callback is called for this
    dead MetaWindow and tries to dereference the window->monitor pointer which is
    already NULL.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671087

 src/core/window.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index aa73533..df80ead 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -215,8 +215,6 @@ meta_window_finalize (GObject *object)
 
   meta_icon_cache_free (&window->icon_cache);
 
-  meta_prefs_remove_listener (prefs_changed_callback, window);
-
   g_free (window->sm_client_id);
   g_free (window->wm_client_machine);
   g_free (window->startup_id);
@@ -1895,6 +1893,8 @@ meta_window_unmanage (MetaWindow  *window,
 
   meta_error_trap_pop (window->display);
 
+  meta_prefs_remove_listener (prefs_changed_callback, window);
+
   g_signal_emit (window, window_signals[UNMANAGED], 0);
 
   g_object_unref (window);



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