diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-18 10:58:24 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-21 07:30:26 +0200 |
commit | 43b2103f932c92374e2ba2ab0ec1006582a0f646 (patch) | |
tree | 8ebd1cb11c3f81ab0ea60a67205d7a39072e74d9 /libreofficekit/qa | |
parent | de244205f2287263ee9013cf37108186aed531cf (diff) |
gtktiledviewer: don't crash on opening non-existing files
Change-Id: Ic48adaf038e8fbcc86a94b5e351d2f963fcfcd16
Diffstat (limited to 'libreofficekit/qa')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index b16993ba29fd..bb60ff165dcf 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -554,8 +554,20 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo if (!lok_doc_view_open_document_finish(pDocView, res, &error)) { - g_warning ("Error occurred while opening the document : %s", error->message); - g_error_free (error); + GtkDialogFlags eFlags = GTK_DIALOG_DESTROY_WITH_PARENT; + GtkWidget* pDialog = gtk_message_dialog_new(GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView))), + eFlags, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "Error occurred while opening the document: '%s'", + error->message); + gtk_dialog_run(GTK_DIALOG(pDialog)); + gtk_widget_destroy(pDialog); + + g_error_free(error); + gtk_widget_destroy(GTK_WIDGET(pDocView)); + gtk_main_quit(); + return; } populatePartSelector(pDocView); |