X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-singletons.c;h=5998e5e5e3945e78cc1b4959bba931175fefa2ce;hp=c373988d406f6f0aa1c53b788d37658b38b50661;hb=bb515e94c04fe931befaebe40d91fa3e9217b7d6;hpb=bf831b6566516e6b57de7a64afb732eb8686e792 diff --git a/src/modest-singletons.c b/src/modest-singletons.c index c373988..5998e5e 100644 --- a/src/modest-singletons.c +++ b/src/modest-singletons.c @@ -173,12 +173,6 @@ modest_singletons_finalize (GObject *obj) 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)); @@ -214,7 +208,17 @@ 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));