Commit 8cf51a7b authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

do not free the error inside _gtk_error_dialog_from_gerror_(show|run)

this caused crashes when more callbacks were registered for the "completed"
signal of a GthTask object.
parent f9c78be0
......@@ -67,7 +67,8 @@ remove_cb (GtkWidget *widget,
bookmarks = gth_main_get_default_bookmarks ();
if (! g_bookmark_file_remove_item (bookmarks, uri, &error)) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not remove the bookmark"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not remove the bookmark"), error);
g_clear_error (&error);
}
gth_main_bookmarks_changed ();
......
......@@ -322,10 +322,10 @@ remove_catalog (GtkWindow *window,
_g_object_list_unref (files);
_g_object_unref (parent);
}
else
_gtk_error_dialog_from_gerror_show (window,
_("Could not remove the catalog"),
&error);
else {
_gtk_error_dialog_from_gerror_show (window, _("Could not remove the catalog"), error);
g_clear_error (&error);
}
g_object_unref (gio_file);
}
......
......@@ -102,7 +102,7 @@ catalog_save_done_cb (void **buffer,
AddData *add_data = user_data;
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (add_data->parent_window), _("Could not add the files to the catalog"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (add_data->parent_window), _("Could not add the files to the catalog"), error);
return;
}
......@@ -133,7 +133,7 @@ catalog_ready_cb (GObject *catalog,
GFile *gio_file;
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (add_data->parent_window), _("Could not add the files to the catalog"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (add_data->parent_window), _("Could not add the files to the catalog"), error);
return;
}
......@@ -214,7 +214,7 @@ new_catalog_metadata_ready_cb (GObject *object,
GtkTreePath *tree_path;
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not create the catalog"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not create the catalog"), error);
return;
}
......
......@@ -77,7 +77,7 @@ catalog_saved_cb (void **buffer,
gth_hook_invoke ("dlg-catalog-properties-saved", data->browser, data->file_data, data->catalog);
}
else
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not save the catalog"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not save the catalog"), error);
gtk_widget_destroy (data->dialog);
}
......@@ -163,7 +163,7 @@ catalog_ready_cb (GObject *object,
DialogData *data = user_data;
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW(data->browser), _("Could not load the catalog"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW(data->browser), _("Could not load the catalog"), error);
gtk_widget_destroy (data->dialog);
return;
}
......
......@@ -1280,7 +1280,7 @@ remove_from_catalog_end (GError *error,
RemoveFromCatalogData *data)
{
if (error != NULL)
_gtk_error_dialog_from_gerror_show (data->parent, _("Could not remove the files from the catalog"), &error);
_gtk_error_dialog_from_gerror_show (data->parent, _("Could not remove the files from the catalog"), error);
g_object_unref (data->catalog);
g_object_unref (data->gio_file);
......
......@@ -479,8 +479,10 @@ theme_dialog_response_cb (GtkDialog *dialog,
theme->display_name,
".cst",
&error);
if (theme->file == NULL)
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), &error);
if (theme->file == NULL) {
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), error);
g_clear_error (&error);
}
g_object_unref (themes_dir);
g_free (themes_path);
......@@ -490,8 +492,9 @@ theme_dialog_response_cb (GtkDialog *dialog,
}
if (! gth_contact_sheet_theme_to_data (theme, &buffer, &buffer_size, &error)) {
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), error);
g_clear_error (&error);
g_free (buffer);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), &error);
return;
}
......@@ -503,8 +506,9 @@ theme_dialog_response_cb (GtkDialog *dialog,
NULL,
&error))
{
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), error);
g_clear_error (&error);
g_free (buffer);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not save the theme"), &error);
return;
}
......@@ -646,8 +650,10 @@ delete_theme_button_clicked_cb (GtkButton *button,
if (theme->file != NULL) {
GError *error = NULL;
if (! g_file_delete (theme->file, NULL, &error))
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not delete the theme"), &error);
if (! g_file_delete (theme->file, NULL, &error)) {
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->dialog), _("Could not delete the theme"), error);
g_clear_error (&error);
}
}
gth_contact_sheet_theme_unref (theme);
......
......@@ -199,8 +199,10 @@ infobar_response_cb (GtkInfoBar *info_bar,
switch (response_id) {
case _RESPONSE_PREFERENCES:
if (! g_spawn_command_line_async (DESKTOP_BACKGROUND_PROPERTIES_COMMAND, &error))
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (wdata->browser), _("Could not show the desktop background properties"), &error);
if (! g_spawn_command_line_async (DESKTOP_BACKGROUND_PROPERTIES_COMMAND, &error)) {
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (wdata->browser), _("Could not show the desktop background properties"), error);
g_clear_error (&error);
}
break;
case _RESPONSE_UNDO:
......@@ -264,7 +266,7 @@ wallpaper_save_ready_cb (GthFileData *a,
WallpaperData *wdata = user_data;
if (error != NULL) {
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (wdata->browser), _("Could not set the desktop background"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (wdata->browser), _("Could not set the desktop background"), error);
wallpaper_data_free (wdata);
return;
}
......@@ -282,7 +284,8 @@ copy_wallpaper_ready_cb (GObject *source_object,
GError *error = NULL;
if (! g_file_copy_finish (G_FILE (source_object), res, &error)) {
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (wdata->browser), _("Could not set the desktop background"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (wdata->browser), _("Could not set the desktop background"), error);
g_clear_error (&error);
wallpaper_data_free (wdata);
return;
}
......
......@@ -112,7 +112,7 @@ load_file_data_task_completed_cb (GthTask *task,
DialogData *data = user_data;
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Cannot read file information"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Cannot read file information"), error);
gtk_widget_destroy (GTK_WIDGET (data->dialog));
return;
}
......
......@@ -123,7 +123,7 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
if (! exiv2_supports_writes (gth_file_data_get_mime_type (file_data)))
return;
if (! g_load_file_in_buffer (file_data->file, &buffer, &size, NULL, &error))
if (! g_load_file_in_buffer (file_data->file, &buffer, &size, cancellable, &error))
return;
metadata = g_file_info_get_attribute_object (file_data->info, "general::description");
......
......@@ -118,7 +118,8 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
if ((url != NULL) && ! gtk_show_uri (screen, url, 0, &error)) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error);
g_clear_error (&error);
}
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
......@@ -169,7 +170,8 @@ upload_photos_ready_cb (GObject *source_object,
data->photos_ids = facebook_service_upload_photos_finish (FACEBOOK_SERVICE (source_object), result, &error);
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
......@@ -309,7 +311,8 @@ get_albums_ready_cb (GObject *source_object,
if (error != NULL) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
......@@ -385,7 +388,8 @@ create_album_ready_cb (GObject *source_object,
if (error != NULL) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), error);
g_clear_error (&error);
return;
}
......@@ -533,7 +537,8 @@ dlg_export_to_facebook (GthBrowser *browser,
GError *error;
error = g_error_new_literal (GTH_ERROR, GTH_ERROR_GENERIC, _("No valid file selected."));
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
......
......@@ -552,7 +552,8 @@ gth_browser_activate_action_folder_open_in_file_manager (GtkAction *action,
gtk_get_current_event_time (),
&error))
{
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (browser), _("Could not open the location"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (browser), _("Could not open the location"), error);
g_clear_error (&error);
}
g_free (uri);
......@@ -699,8 +700,10 @@ delete_folder_permanently (GtkWindow *window,
gtk_widget_destroy (d);
}
else
_gtk_error_dialog_from_gerror_show (window, _("Could not delete the folder"), &error);
else {
_gtk_error_dialog_from_gerror_show (window, _("Could not delete the folder"), error);
g_clear_error (&error);
}
}
else {
GFile *parent;
......@@ -765,8 +768,10 @@ gth_browser_activate_action_folder_trash (GtkAction *action,
g_signal_connect (d, "response", G_CALLBACK (delete_folder_permanently_response_cb), delete_data);
gtk_widget_show (d);
}
else
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not move the folder to the Trash"), &error);
else {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not move the folder to the Trash"), error);
g_clear_error (&error);
}
}
else {
GFile *parent;
......
......@@ -924,10 +924,12 @@ activate_open_with_application_item (GtkMenuItem *menuitem,
gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (browser)));
gdk_app_launch_context_set_timestamp (context, 0);
gdk_app_launch_context_set_icon (context, g_app_info_get_icon (appinfo));
if (! g_app_info_launch_uris (appinfo, uris, G_APP_LAUNCH_CONTEXT (context), &error))
if (! g_app_info_launch_uris (appinfo, uris, G_APP_LAUNCH_CONTEXT (context), &error)) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser),
_("Could not perform the operation"),
&error);
error);
g_clear_error (&error);
}
g_object_unref (context);
g_list_free (uris);
......
......@@ -607,7 +607,7 @@ done_func (GObject *object,
self->priv->io_operation = FALSE;
if ((error != NULL) && ! g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not perform the operation"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not perform the operation"), error);
gtk_widget_destroy (GET_WIDGET ("find_duplicates_dialog"));
return;
}
......
......@@ -134,7 +134,8 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
if ((url != NULL) && ! gtk_show_uri (screen, url, 0, &error)) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error);
g_clear_error (&error);
}
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
......@@ -183,7 +184,8 @@ add_photos_to_photoset_ready_cb (GObject *source_object,
GError *error = NULL;
if (! flickr_service_add_photos_to_set_finish (FLICKR_SERVICE (source_object), result, &error)) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
......@@ -217,7 +219,8 @@ create_photoset_ready_cb (GObject *source_object,
g_object_unref (data->photoset);
data->photoset = flickr_service_create_photoset_finish (FLICKR_SERVICE (source_object), result, &error);
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
}
else {
......@@ -239,7 +242,8 @@ post_photos_ready_cb (GObject *source_object,
data->photos_ids = flickr_service_post_photos_finish (FLICKR_SERVICE (source_object), result, &error);
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
......@@ -392,7 +396,8 @@ photoset_list_ready_cb (GObject *source_object,
if (error != NULL) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
......@@ -519,7 +524,8 @@ dlg_export_to_flickr (FlickrServer *server,
GError *error;
error = g_error_new_literal (GTH_ERROR, GTH_ERROR_GENERIC, _("No valid file selected."));
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), error);
g_clear_error (&error);
gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
......
......@@ -231,7 +231,8 @@ photoset_list_ready_cb (GObject *source_object,
if (error != NULL) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error);
g_clear_error (&error);
gtk_widget_destroy (data->dialog);
return;
}
......@@ -353,7 +354,8 @@ list_photos_ready_cb (GObject *source_object,
if (error != NULL) {
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE, NULL);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), error);
g_clear_error (&error);
gtk_widget_destroy (data->dialog);
return;
}
......
......@@ -61,7 +61,7 @@ screenshot_saved_cb (GthFileData *file_data,
GthMediaViewerPage *page = save_data->page;
if (error != NULL)
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (save_data->browser), _("Could not save the file"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (save_data->browser), _("Could not save the file"), error);
else if (save_data->playing_before_screenshot)
gst_element_set_state (gth_media_viewer_page_get_playbin (page), GST_STATE_PLAYING);
......
......@@ -60,12 +60,15 @@ gth_browser_activate_action_file_print (GtkAction *action,
&error);
_g_object_unref (current_image);
if (print_job != NULL)
if (print_job != NULL) {
gth_image_print_job_run (print_job,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
browser);
else
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not print the selected files"), &error);
}
else {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not print the selected files"), error);
g_clear_error (&error);
}
}
_g_object_list_unref (file_list);
......
......@@ -1758,7 +1758,8 @@ print_operation_done_cb (GtkPrintOperation *operation,
GError *error = NULL;
gtk_print_operation_get_error (self->priv->print_operation, &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not print"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not print"), error);
g_clear_error (&error);
return;
}
else if (result == GTK_PRINT_OPERATION_RESULT_APPLY) {
......@@ -1920,8 +1921,10 @@ load_image_info_task_completed_cb (GthTask *task,
self->priv->action,
GTK_WINDOW (self->priv->browser),
&error);
if (result == GTK_PRINT_OPERATION_RESULT_ERROR)
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not print"), &error);
if (result == GTK_PRINT_OPERATION_RESULT_ERROR) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not print"), error);
g_clear_error (&error);
}
_g_object_unref (settings);
}
......
......@@ -1118,7 +1118,7 @@ image_saved_cb (GthFileData *file_data,
if (data->func != NULL)
(data->func) ((GthViewerPage *) self, self->priv->file_data, error, data->user_data);
else if (error != NULL)
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not save the file"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (self->priv->browser), _("Could not save the file"), error);
if (! error_occurred) {
GFile *folder;
......
......@@ -352,7 +352,8 @@ script_editor_dialog__response_cb (GtkDialog *dialog,
script = gth_script_editor_dialog_get_script (GTH_SCRIPT_EDITOR_DIALOG (dialog), &error);
if (script == NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (dialog), _("Could not save the script"), &error);
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (dialog), _("Could not save the script"), error);
g_clear_error (&error);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment