gtktiledviewer: don't crash on opening non-existing files
Change-Id: Ic48adaf038e8fbcc86a94b5e351d2f963fcfcd16
This commit is contained in:
@@ -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);
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user