Blame SOURCES/0001-gtktiledviewer-allow-testing-of-destroyView.patch

135360
From 905beaa8e862323199263feaeb6262f43fbfc0bc Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Fri, 15 Jul 2016 15:37:51 +0200
135360
Subject: [PATCH] gtktiledviewer: allow testing of destroyView()
135360
135360
By calling it when we're not the last window.
135360
135360
Change-Id: I6fd4763243fc088ccfe015b6c03b6b3f25146fac
135360
---
135360
 libreofficekit/source/gtk/lokdocview.cxx | 15 +++++++++++++--
135360
 1 file changed, 13 insertions(+), 2 deletions(-)
135360
135360
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
135360
index 92cf6b3..b6f34ac 100644
135360
--- a/libreofficekit/source/gtk/lokdocview.cxx
135360
+++ b/libreofficekit/source/gtk/lokdocview.cxx
135360
@@ -127,6 +127,9 @@ struct LOKDocViewPrivateImpl
135360
     /// View ID, returned by createView() or 0 by default.
135360
     int m_nViewId;
135360
 
135360
+    /// Event source ID for handleTimeout() of this widget.
135360
+    guint m_nTimeoutId;
135360
+
135360
     LOKDocViewPrivateImpl()
135360
         : m_aLOPath(nullptr),
135360
         m_pUserProfileURL(nullptr),
135360
@@ -165,11 +168,19 @@ struct LOKDocViewPrivateImpl
135360
         m_aHandleEndRect({0, 0, 0, 0}),
135360
         m_bInDragEndHandle(false),
135360
         m_pGraphicHandle(nullptr),
135360
-        m_nViewId(0)
135360
+        m_nViewId(0),
135360
+        m_nTimeoutId(0)
135360
     {
135360
         memset(&m_aGraphicHandleRects, 0, sizeof(m_aGraphicHandleRects));
135360
         memset(&m_bInDragGraphicHandles, 0, sizeof(m_bInDragGraphicHandles));
135360
     }
135360
+
135360
+    ~LOKDocViewPrivateImpl()
135360
+    {
135360
+        if (m_nTimeoutId)
135360
+            g_source_remove(m_nTimeoutId);
135360
+    }
135360
+
135360
 };
135360
 
135360
 /// Wrapper around LOKDocViewPrivateImpl, managed by malloc/memset/free.
135360
@@ -768,7 +779,7 @@ static gboolean postDocumentLoad(gpointer pData)
135360
     priv->m_pDocument->pClass->initializeForRendering(priv->m_pDocument, priv->m_aRenderingArguments.c_str());
135360
     priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, callbackWorker, pLOKDocView);
135360
     priv->m_pDocument->pClass->getDocumentSize(priv->m_pDocument, &priv->m_nDocumentWidthTwips, &priv->m_nDocumentHeightTwips);
135360
-    g_timeout_add(600, handleTimeout, pLOKDocView);
135360
+    priv->m_nTimeoutId = g_timeout_add(600, handleTimeout, pLOKDocView);
135360
 
135360
     float zoom = priv->m_fZoom;
135360
     long nDocumentWidthTwips = priv->m_nDocumentWidthTwips;
135360
-- 
135360
1.8.3.1
135360