From 0bb199cdf8c63341361fa93bf4bd85336a993a00 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Sun, 1 Oct 2006 17:23:40 +0000 Subject: Fixes path memory issues with the save dialog. (Closes: #1089414) (bzr r1747) --- src/file.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index de8ab2b5d..f8ebc9809 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -589,7 +589,8 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) save_loc.append(formatBuf); } } else { - save_loc = Glib::path_get_dirname(doc->uri); + save_loc = Glib::build_filename(Glib::path_get_dirname(doc->uri), + Glib::path_get_basename(doc->uri)); } // convert save_loc from utf-8 to locale @@ -615,6 +616,8 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) (char const *) _("Select file to save to"), default_extension ); + else + saveDialogInstance->change_path(save_loc); saveDialogInstance->change_title(dialog_title); bool success = saveDialogInstance->show(); @@ -640,7 +643,7 @@ sp_file_save_dialog(SPDocument *doc, bool is_copy) if (success) prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc)); - save_path = fileName; + save_path = Glib::path_get_dirname(fileName); prefs_set_string_attribute("dialogs.save_as", "path", save_path.c_str()); return success; -- cgit v1.2.3