summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-05-01 18:36:10 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2011-05-01 23:49:21 -0400
commita20e16dedb851f39d9612c87dab5065ba74bff32 (patch)
tree72068cfd8ea237a7d0f684955f73aa66c920bfc3
parentfdcc2f36f549a18ea6f587fb9e9bad97f0114c59 (diff)
downloadnautilus-a20e16dedb851f39d9612c87dab5065ba74bff32.tar.gz
mime-actions: don't free the activation parameters early
This fixes a segfault when clicking on the "Select Application" button when opening a file with no default applications, like in https://bugzilla.redhat.com/show_bug.cgi?id=699850
-rw-r--r--src/nautilus-mime-actions.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 9fa48b7e3..daf41c84b 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -1150,6 +1150,8 @@ open_with_response_cb (GtkDialog *dialog,
nautilus_launch_application (info, &files, parent_window);
g_object_unref (info);
+
+ activate_parameters_install_free (parameters);
}
static void
@@ -1162,6 +1164,7 @@ choose_program (GtkDialog *message_dialog, int response, gpointer callback_data)
if (response != GTK_RESPONSE_ACCEPT){
gtk_widget_destroy (GTK_WIDGET (message_dialog));
+ activate_parameters_install_free (parameters);
return;
}
@@ -1172,6 +1175,9 @@ choose_program (GtkDialog *message_dialog, int response, gpointer callback_data)
location = nautilus_file_get_location (file);
nautilus_file_ref (file);
+ /* Destroy the message dialog after ref:ing the file */
+ gtk_widget_destroy (GTK_WIDGET (message_dialog));
+
dialog = gtk_app_chooser_dialog_new (parameters->parent_window,
0, location);
g_object_set_data_full (G_OBJECT (dialog),
@@ -1179,16 +1185,12 @@ choose_program (GtkDialog *message_dialog, int response, gpointer callback_data)
nautilus_file_ref (file),
(GDestroyNotify)nautilus_file_unref);
- /* Destroy the message dialog after ref:ing the file */
- gtk_widget_destroy (GTK_WIDGET (message_dialog));
-
gtk_widget_show (dialog);
- g_signal_connect_object (dialog,
- "response",
- G_CALLBACK (open_with_response_cb),
- parameters,
- 0);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (open_with_response_cb),
+ parameters);
g_object_unref (location);
nautilus_file_unref (file);
@@ -1439,9 +1441,10 @@ application_unhandled_uri (ActivateParameters *parameters, char *uri)
/* There is no use trying to look for handlers of application/octet-stream */
if (g_content_type_is_unknown (mime_type)) {
show_install_mime = FALSE;
- goto out;
}
+ g_free (mime_type);
+
if (!show_install_mime) {
goto out;
}
@@ -1461,10 +1464,6 @@ application_unhandled_uri (ActivateParameters *parameters, char *uri)
out:
/* show an unhelpful dialog */
show_unhandled_type_error (parameters_install);
- /* The callback wasn't started, so we have to free the parameters */
- activate_parameters_install_free (parameters_install);
-
- g_free (mime_type);
}
typedef struct {