* unitialize modest-window-mgr before the other singletons, so
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 6 Jul 2007 07:10:51 +0000 (07:10 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 6 Jul 2007 07:10:51 +0000 (07:10 +0000)
  it can still save it's settings etc. in its finalize
  (this was causing GLib-Criticals upon exit in some cases,
  as well as forgetting settings)
* before doing gtk_main_quit in modest-window-mgr, check that we
  haven't already done that (not sure if we actually *ever* should
  call gtk_main_quit there, but at least now this clears up
  another Glib-Critical upon exit in some cases

pmo-trunk-r2603

src/modest-singletons.c
src/widgets/modest-window-mgr.c

index 5998e5e..e756b11 100644 (file)
@@ -166,7 +166,13 @@ modest_singletons_finalize (GObject *obj)
        ModestSingletonsPrivate *priv;
                
        priv = MODEST_SINGLETONS_GET_PRIVATE(obj);
-
+       
+       if (priv->window_mgr) {
+               modest_runtime_verify_object_last_ref(priv->window_mgr,"");
+               g_object_unref (G_OBJECT(priv->window_mgr));
+               priv->window_mgr = NULL;
+       }
+       
        if (priv->account_store) {
                modest_runtime_verify_object_last_ref(priv->account_store,"");
                g_object_unref (G_OBJECT(priv->account_store));
@@ -179,12 +185,6 @@ modest_singletons_finalize (GObject *obj)
                priv->email_clipboard = NULL;
        }
 
-       if (priv->conf) {
-               modest_runtime_verify_object_last_ref(priv->conf,"");
-               g_object_unref (G_OBJECT(priv->conf));
-               priv->conf = NULL;
-       }
-
        if (priv->cache_mgr) {
                modest_runtime_verify_object_last_ref(priv->cache_mgr,"");
                g_object_unref (G_OBJECT(priv->cache_mgr));
@@ -218,13 +218,13 @@ modest_singletons_finalize (GObject *obj)
                g_object_unref (G_OBJECT(priv->account_mgr));
                priv->account_mgr = NULL;
        }
-
-       if (priv->window_mgr) {
-               modest_runtime_verify_object_last_ref(priv->window_mgr,"");
-               g_object_unref (G_OBJECT(priv->window_mgr));
-               priv->window_mgr = NULL;
+       
+       if (priv->conf) {
+               modest_runtime_verify_object_last_ref(priv->conf,"");
+               g_object_unref (G_OBJECT(priv->conf));
+               priv->conf = NULL;
        }
-
+       
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
index 1cb1ae7..ca27a2c 100644 (file)
@@ -496,7 +496,9 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self,
                                      priv->show_toolbars, NULL);
 
                /* Quit main loop */
-               gtk_main_quit ();
+               /* FIXME: do we ever need to do this here? */
+               if (gtk_main_level() > 0)
+                       gtk_main_quit ();
        }
 }