[gnome-control-center] region: Fix crash when changing the language



commit de1b612cc0b8a4aa61eaf0e81ace6d59814c0b18
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 20 14:53:41 2013 +0100

    region: Fix crash when changing the language
    
    1. Load region panel
    2. Change language
    3. Go back to overview
    4. Load region panel
    5. Change language
    6. Crash
    
    As the ActUser and ActUserManager object aren't reference counted,
    we need to disconnect the signals ourselves when exiting the panel
    otherwise we'll receive the signals from the old signal connection,
    which will use the old panel object.

 panels/region/cc-region-panel.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index dbcb45e..490b41a 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -122,8 +122,16 @@ cc_region_panel_finalize (GObject *object)
        CcRegionPanel *self = CC_REGION_PANEL (object);
        CcRegionPanelPrivate *priv = self->priv;
 
-        priv->user_manager = NULL;
-        priv->user = NULL;
+        if (priv->user_manager) {
+                g_signal_handlers_disconnect_by_data (priv->user_manager, self);
+                priv->user_manager = NULL;
+        }
+
+        if (priv->user) {
+                g_signal_handlers_disconnect_by_data (priv->user, self);
+                priv->user = NULL;
+        }
+
         g_clear_object (&priv->permission);
         g_clear_object (&priv->localed);
         g_clear_object (&priv->builder);


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