From 24ac01bfa92b0bdb94e13b7cc58e78e2be5fc6c7 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman <muks@banu.com> Date: Sat, 7 May 2011 05:51:30 +0530 Subject: [PATCH] app: Fix corruption while in use of imported uri --- app/actions/file-commands.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c index 2395e2ef37..581edf2112 100644 --- a/app/actions/file-commands.c +++ b/app/actions/file-commands.c @@ -302,11 +302,21 @@ file_save_cmd_callback (GtkAction *action, if (uri && export_proc) { + char *uri_copy; + + /* The memory that 'uri' points to can be freed by + file_save_dialog_save_image(), when it eventually calls + gimp_image_set_imported_uri() to reset the imported uri, + resulting in garbage. So make a duplicate of it here. */ + + uri_copy = g_strdup (uri); + saved = file_save_dialog_save_image (GIMP_PROGRESS (display), - gimp, image, uri, + gimp, image, uri_copy, export_proc, GIMP_RUN_WITH_LAST_VALS, FALSE, TRUE, TRUE); + g_free (uri_copy); } } break;