* Partially fixes NB#85461, do not unload the folder before synchronizing it
[modest] / src / widgets / modest-folder-view.c
index e04d468..da8e834 100644 (file)
@@ -1465,14 +1465,18 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
        
        /* Current folder was unselected */
        if (priv->cur_folder_store) {
-               g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
-                      priv->cur_folder_store, FALSE);
-
+               /* We must do this firstly because a libtinymail-camel
+                  implementation detail. If we issue the signal
+                  before doing the sync_async, then that signal could
+                  cause (and it actually does it) a free of the
+                  summary of the folder (because the main window will
+                  clear the headers view */
                if (TNY_IS_FOLDER(priv->cur_folder_store))
                        tny_folder_sync_async (TNY_FOLDER(priv->cur_folder_store),
                                               FALSE, NULL, NULL, NULL);
 
-               /* FALSE --> don't expunge the messages */
+               g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
+                      priv->cur_folder_store, FALSE);
 
                g_object_unref (priv->cur_folder_store);
                priv->cur_folder_store = NULL;