[Libreoffice-commits] core.git: libreofficekit/qa

Miklos Vajna vmiklos at collabora.co.uk
Thu Jul 28 08:54:49 UTC 2016


 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 538ea31c992acb9d47ffd783543e50e149272aac
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Jul 28 09:52:25 2016 +0200

    gtktiledviewer: quit after the last view is destroyed
    
    To allow debugging crash-on-exit problems.
    
    Change-Id: Ie54a8391e721c3ba8034b4618dd30733bac97a27
    Reviewed-on: https://gerrit.libreoffice.org/27605
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 58139a5..37cf7e2 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -1210,13 +1210,28 @@ static void openDocumentCallback (GObject* source_object, GAsyncResult* res, gpo
     gtk_widget_hide(rWindow.m_pProgressBar);
 }
 
+/**
+ * Wrapper around gtk_widget_destroy() that quits when the last tiled window is
+ * destroyed.
+ */
+static void destroyWindow(GtkWidget* pWidget)
+{
+    gtk_widget_destroy(pWidget);
+    auto it = g_aWindows.find(pWidget);
+    if (it != g_aWindows.end())
+        g_aWindows.erase(it);
+
+    if (g_aWindows.empty())
+        gtk_main_quit();
+}
+
 /// Creates the GtkWindow that has main widget as children and registers it in the window map.
 static GtkWidget* createWindow(TiledWindow& rWindow)
 {
     GtkWidget *pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_title(GTK_WINDOW(pWindow), "LibreOfficeKit GTK Tiled Viewer");
     gtk_window_set_default_size(GTK_WINDOW(pWindow), 1024, 768);
-    g_signal_connect(pWindow, "destroy", G_CALLBACK(gtk_widget_destroy), pWindow);
+    g_signal_connect(pWindow, "destroy", G_CALLBACK(destroyWindow), pWindow);
 
     rWindow.m_pVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
     gtk_container_add(GTK_CONTAINER(pWindow), rWindow.m_pVBox);


More information about the Libreoffice-commits mailing list