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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user