Avoid a crash on requesting to open a msg view that window mgr rejects.
authorJosé Dapena Paz <jdapena@igalia.com>
Mon, 15 Feb 2010 16:45:51 +0000 (17:45 +0100)
committerJosé Dapena Paz <jdapena@igalia.com>
Mon, 15 Feb 2010 17:08:52 +0000 (18:08 +0100)
src/hildon2/modest-msg-view-window.c

index f3ff4f0..cf2f3f3 100644 (file)
@@ -2209,10 +2209,10 @@ view_msg_cb (ModestMailOperation *mail_op,
        modest_window_mgr_unregister_header (modest_runtime_get_window_mgr (), header);
 
        row_reference = (GtkTreeRowReference *) user_data;
        modest_window_mgr_unregister_header (modest_runtime_get_window_mgr (), header);
 
        row_reference = (GtkTreeRowReference *) user_data;
-       if (canceled) {
+       self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
+       if (canceled || !self || MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self)->msg_view == NULL ) {
                if (row_reference)
                        gtk_tree_row_reference_free (row_reference);
                if (row_reference)
                        gtk_tree_row_reference_free (row_reference);
-               self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
                if (self) {
                        /* Restore window title */
                        update_window_title (self);
                if (self) {
                        /* Restore window title */
                        update_window_title (self);
@@ -2226,7 +2226,6 @@ view_msg_cb (ModestMailOperation *mail_op,
        if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
                if (row_reference)
                        gtk_tree_row_reference_free (row_reference);
        if (!modest_ui_actions_msg_retrieval_check (mail_op, header, msg)) {
                if (row_reference)
                        gtk_tree_row_reference_free (row_reference);
-               self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
                if (self) {
                        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
                        /* First we check if the parent is a folder window */
                if (self) {
                        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
                        /* First we check if the parent is a folder window */
@@ -2290,7 +2289,6 @@ view_msg_cb (ModestMailOperation *mail_op,
        }
 
        /* Get the window */ 
        }
 
        /* Get the window */ 
-       self = (ModestMsgViewWindow *) modest_mail_operation_get_source (mail_op);
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self));
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
 
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self));
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);