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

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