From 05c9f6824d14012a71528bd204bcdd4e6624db29 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 11 Oct 2012 12:34:08 +0900 Subject: Fix for 426763 : Cancelling import leads to error message (bzr r11777) --- src/file.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index 778306d5d..a03c459da 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -235,12 +235,16 @@ bool sp_file_open(const Glib::ustring &uri, } SPDocument *doc = NULL; + bool cancelled = false; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { doc = NULL; } catch (Inkscape::Extension::Input::open_failed &e) { doc = NULL; + } catch (Inkscape::Extension::Input::open_cancelled &e) { + doc = NULL; + cancelled = true; } if (desktop) { @@ -287,7 +291,7 @@ bool sp_file_open(const Glib::ustring &uri, } return TRUE; - } else { + } else if (!cancelled) { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), safeUri); sp_ui_error_dialog(text); @@ -295,6 +299,8 @@ bool sp_file_open(const Glib::ustring &uri, g_free(safeUri); return FALSE; } + + return FALSE; } /** -- cgit v1.2.3 From 4b2c5f1410bce434005641ad6849f2d02a920e82 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 26 Oct 2012 13:39:55 +0200 Subject: Fix for Bug #1070903 (Crash when saving a new document). (bzr r11828) --- src/file.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index a03c459da..cb4ea591c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -952,7 +952,13 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) } } } else { - Glib::ustring msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getURI()); + Glib::ustring msg; + if ( doc->getURI() == NULL ) + { + msg = Glib::ustring::format(_("No changes need to be saved.")); + } else { + msg = Glib::ustring::format(_("No changes need to be saved."), " ", doc->getURI()); + } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg.c_str()); success = TRUE; } -- cgit v1.2.3 From 258b9b4a5dd01aceebf244522bab72f47b60ea03 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 28 Oct 2012 18:31:24 +0100 Subject: Fix for Bug #1072391 (Save as copy crash). (bzr r11848) --- src/file.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index cb4ea591c..14f70fc8c 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -675,7 +675,12 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, } SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); - Glib::ustring msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); + Glib::ustring msg; + if (doc->getURI() == NULL) { + msg = Glib::ustring::format(_("Document saved.")); + } else { + msg = Glib::ustring::format(_("Document saved."), " ", doc->getURI()); + } SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, msg.c_str()); return true; } -- cgit v1.2.3