From 906deef80961e9949d3bec7ef1d2a8b1c1fc8f65 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 26 Jan 2018 20:32:29 +0100 Subject: OCAL dialog: make requests non-blocking on windows - Revert 738e2fcae54ef8764d33d3a47bf7868641efdcfd (which introduced asynchronous call) - Instead properly catch exceptions from load_contents_finish() which were probably what caused the crashes in the first place Fixed bug: - https://bugs.launchpad.net/inkscape/+bug/1745521 --- src/ui/dialog/ocaldialogs.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 13ce4e4cd..4302161dc 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -964,12 +964,6 @@ void ImportDialog::on_entry_search_activated() // Open the RSS feed Glib::RefPtr xml_file = Gio::File::create_for_uri(xml_uri); -#ifdef WIN32 - if (!xml_file->query_exists()) { - widget_status->set_error(_("Could not connect to the Open Clip Art Library")); - return; - } -#endif xml_file->load_contents_async( sigc::bind , Glib::ustring>( sigc::mem_fun(*this, &ImportDialog::on_xml_file_read), @@ -982,11 +976,18 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr& result { widget_status->end_process(); + bool success; char* data; gsize length; - bool sucess = xml_file->load_contents_finish(result, data, length); - if (!sucess) { + try { + success = xml_file->load_contents_finish(result, data, length); + } catch(Glib::Error &e) { + success = false; + g_warning("ImportDialog::on_xml_file_read():\n\tFailed to retrieve '%s'\n\t%s", + xml_uri.c_str(), e.what().c_str()); + } + if (!success) { widget_status->set_error(_("Could not connect to the Open Clip Art Library")); return; } -- cgit v1.2.3