X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-singletons.c;h=e756b114950f812e83d45f399dbfa02ced8590c7;hp=c373988d406f6f0aa1c53b788d37658b38b50661;hb=e7c11995eead176629592f70148b088d3c3185e2;hpb=bf831b6566516e6b57de7a64afb732eb8686e792 diff --git a/src/modest-singletons.c b/src/modest-singletons.c index c373988..e756b11 100644 --- a/src/modest-singletons.c +++ b/src/modest-singletons.c @@ -166,31 +166,25 @@ 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)); priv->account_store = NULL; } - if (priv->account_mgr) { - modest_runtime_verify_object_last_ref(priv->account_mgr,""); - g_object_unref (G_OBJECT(priv->account_mgr)); - priv->account_mgr = NULL; - } - if (priv->email_clipboard) { modest_runtime_verify_object_last_ref(priv->email_clipboard,""); g_object_unref (G_OBJECT(priv->email_clipboard)); 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)); @@ -214,13 +208,23 @@ modest_singletons_finalize (GObject *obj) g_object_unref (G_OBJECT(priv->mail_op_queue)); priv->mail_op_queue = NULL; } + + /* It is important that the account manager is uninitialized after + * the mail op queue is uninitialized because the mail op queue + * cancells any mail operations which in turn access the account + * manager (see modest_mail_operation_notify_end()). */ + if (priv->account_mgr) { + modest_runtime_verify_object_last_ref(priv->account_mgr,""); + 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); }