diff options
author | Milan Crha <mcrha@redhat.com> | 2014-02-24 19:52:48 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-02-24 19:52:48 +0800 |
commit | aceed006fdfbe40bdfd4816dd2baab0f27259246 (patch) | |
tree | 12bdba521b8bffb13636f0c6067784853524dc30 | |
parent | 9f7e6ac6e3fcc9e201973fed064c38c9a7addd2f (diff) | |
download | gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.tar gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.tar.gz gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.tar.bz2 gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.tar.lz gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.tar.xz gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.tar.zst gsoc2013-evolution-aceed006fdfbe40bdfd4816dd2baab0f27259246.zip |
mail_session_dispose: First free folders, only then stores
CamelFolder holds a weak reference to its parent CamelStore, thus
if the store is freed before the folder, then the folder cannot
access it, which can lead to crashes.
-rw-r--r-- | libemail-engine/e-mail-session.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c index 2460f9bf92..42605ea579 100644 --- a/libemail-engine/e-mail-session.c +++ b/libemail-engine/e-mail-session.c @@ -901,6 +901,24 @@ mail_session_dispose (GObject *object) priv->folder_cache = NULL; } + g_ptr_array_set_size (priv->local_folders, 0); + g_ptr_array_set_size (priv->local_folder_uris, 0); + + if (priv->preparing_flush > 0) { + g_source_remove (priv->preparing_flush); + priv->preparing_flush = 0; + } + + if (priv->local_store != NULL) { + g_object_unref (priv->local_store); + priv->local_store = NULL; + } + + if (priv->vfolder_store != NULL) { + g_object_unref (priv->vfolder_store); + priv->vfolder_store = NULL; + } + if (priv->registry != NULL) { g_signal_handler_disconnect ( priv->registry, @@ -925,24 +943,6 @@ mail_session_dispose (GObject *object) priv->registry = NULL; } - if (priv->local_store != NULL) { - g_object_unref (priv->local_store); - priv->local_store = NULL; - } - - if (priv->vfolder_store != NULL) { - g_object_unref (priv->vfolder_store); - priv->vfolder_store = NULL; - } - - g_ptr_array_set_size (priv->local_folders, 0); - g_ptr_array_set_size (priv->local_folder_uris, 0); - - if (priv->preparing_flush > 0) { - g_source_remove (priv->preparing_flush); - priv->preparing_flush = 0; - } - /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_mail_session_parent_class)->dispose (object); } |