* Fixed a couple of criticals when closing the main window after issuing a folder...
authorSergio Villar Senin <svillar@igalia.com>
Thu, 10 Apr 2008 10:49:04 +0000 (10:49 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 10 Apr 2008 10:49:04 +0000 (10:49 +0000)
pmo-trunk-r4393

src/maemo/modest-main-window.c
src/modest-ui-actions.c

index 894c852..31d4bf3 100644 (file)
@@ -445,7 +445,9 @@ modest_main_window_get_child_widget (ModestMainWindow *self,
                return NULL;
        }
 
-       return widget ? GTK_WIDGET(widget) : NULL;
+       /* Note that the window could have been destroyed, and so
+          their children, but still have some references */
+       return (widget && GTK_IS_WIDGET(widget)) ? GTK_WIDGET(widget) : NULL;
 }
 
 static gboolean 
index 8a0620e..3cef81b 100644 (file)
@@ -2872,9 +2872,12 @@ do_create_folder_cb (ModestMailOperation *mail_op,
                        folder_view =
                                get_folder_view_from_move_to_dialog (GTK_WIDGET(source_win));
                
-               /* Select the newly created folder */
-               modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view),
-                                                 new_folder, FALSE);
+               /* Select the newly created folder. It could happen
+                  that the widget is no longer there (i.e. the window
+                  has been destroyed, so we need to check this */
+               if (folder_view)
+                       modest_folder_view_select_folder (MODEST_FOLDER_VIEW (folder_view),
+                                                         new_folder, FALSE);
                g_object_unref (new_folder);
        }
        /* Free. Note that the first time it'll be NULL so noop */