summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-18 10:58:24 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-21 07:30:26 +0200
commit43b2103f932c92374e2ba2ab0ec1006582a0f646 (patch)
tree8ebd1cb11c3f81ab0ea60a67205d7a39072e74d9 /libreofficekit
parentde244205f2287263ee9013cf37108186aed531cf (diff)
gtktiledviewer: don't crash on opening non-existing files
Change-Id: Ic48adaf038e8fbcc86a94b5e351d2f963fcfcd16
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx16
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx2
2 files changed, 14 insertions, 4 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);
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 85dc29b5c076..82233cf10e4f 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1225,9 +1225,7 @@ openDocumentInThread (gpointer data)
priv->m_pDocument = priv->m_pOffice->pClass->documentLoad( priv->m_pOffice, priv->m_aDocPath );
if ( !priv->m_pDocument )
{
- // FIXME: should have a GError parameter and populate it.
char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );
- fprintf( stderr, "Error opening document '%s'\n", pError );
g_task_return_new_error(task, 0, 0, "%s", pError);
}
else