[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 3 commits - libreofficekit/qa libreofficekit/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Sep 18 04:21:52 PDT 2015
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 25 ++++++++++++++++----
libreofficekit/source/gtk/lokdocview.cxx | 2 -
libreofficekit/source/gtk/tilebuffer.cxx | 2 +
3 files changed, 22 insertions(+), 7 deletions(-)
New commits:
commit d331c89e90f521ee7260ee2b177a9e7e14e1ea60
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 18 13:21:07 2015 +0200
lokdocview: fix memory leak when painting new tiles
Change-Id: Iad7591c92950ac53d7cbbe21080e5001b6d2d3e2
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 75c3d0d..cbb2421 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -38,6 +38,8 @@ GdkPixbuf* Tile::getBuffer()
void Tile::setPixbuf(GdkPixbuf *buffer)
{
+ if (m_pBuffer)
+ g_object_unref(G_OBJECT(m_pBuffer));
m_pBuffer = buffer;
}
commit 664d5cfef04858743f87f30e1bab4a3ed8bff221
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 18 11:14:58 2015 +0200
gtktiledviewer: fix leftover import progressbar in createView()
Change-Id: Ia71e80c521cdc6a8e4df52e51e063a44a0dd53df
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index bb60ff1..8686b00 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -194,12 +194,13 @@ static void toggleFindbar(GtkWidget* pButton, gpointer /*pItem*/)
}
/// Common initialization, regardless if it's just a new view or a full init.
-static void setupWidgetAndCreateWindow(GtkWidget* pDocView)
+static TiledWindow& setupWidgetAndCreateWindow(GtkWidget* pDocView)
{
setupDocView(pDocView);
TiledWindow aWindow;
aWindow.m_pDocView = pDocView;
- createWindow(aWindow);
+ GtkWidget* pWindow = createWindow(aWindow);
+ return lcl_getTiledWindow(pWindow);
}
/// Creates a new view, i.e. no LOK init or document load.
@@ -208,7 +209,9 @@ static void createView(GtkWidget* pButton, gpointer /*pItem*/)
TiledWindow& rWindow = lcl_getTiledWindow(pButton);
GtkWidget* pDocView = lok_doc_view_new_from_widget(LOK_DOC_VIEW(rWindow.m_pDocView));
- setupWidgetAndCreateWindow(pDocView);
+ TiledWindow& rNewWindow = setupWidgetAndCreateWindow(pDocView);
+ // Hide status bar that contains the unused progress bar.
+ gtk_widget_hide(rNewWindow.m_pStatusBar);
}
/// Creates a new model, i.e. LOK init and document load, one view implicitly.
commit adc7ccb159def93ac2fcc54ab4450bbd8c131db5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 18 10:58:24 2015 +0200
gtktiledviewer: don't crash on opening non-existing files
Change-Id: Ic48adaf038e8fbcc86a94b5e351d2f963fcfcd16
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index b16993b..bb60ff1 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 85dc29b..82233cf 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
More information about the Libreoffice-commits
mailing list