From 04966dbfbdc8b43e9a02fd939a511be93c6fe9f5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 26 Sep 2013 21:25:44 +0200 Subject: Fix for Bug #1229605 (inkscape crashes when canceled import pdf). Fixed bugs: - https://launchpad.net/bugs/1229605 (bzr r12595) --- src/file.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/file.cpp') diff --git a/src/file.cpp b/src/file.cpp index b19fe21ff..e0675e8cf 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1143,7 +1143,8 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - + bool cancelled = false; + //DEBUG_MESSAGE( fileImport, "file_import( in_doc:%p uri:[%s], key:%p", in_doc, uri, key ); SPDocument *doc; try { @@ -1152,6 +1153,9 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, doc = NULL; } catch (Inkscape::Extension::Input::open_failed &e) { doc = NULL; + } catch (Inkscape::Extension::Input::open_cancelled &e) { + doc = NULL; + cancelled = true; } if (doc != NULL) { @@ -1248,7 +1252,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, DocumentUndo::done(in_doc, SP_VERB_FILE_IMPORT, _("Import")); return new_obj; - } else { + } else if (!cancelled) { gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), uri.c_str()); sp_ui_error_dialog(text); g_free(text); -- cgit v1.2.3