libreofficekit/source/gtk/lokdocview.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 805adaae918d91cbde510aef6d7422cb345c41d4
Author: Caolán McNamara <[email protected]>
Date:   Fri Jun 16 15:30:10 2017 +0100

    Resolves: rhbz#1454693 segv if tiled rendering is interrupted
    
    Change-Id: I1131f246c43806adb8a83f6eeafca2b734851a0e
    Reviewed-on: https://gerrit.libreoffice.org/38888
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index ceda8160c9dd..0a81d3679b69 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1148,6 +1148,14 @@ callback (gpointer pData)
     LOKDocView* pDocView = LOK_DOC_VIEW (pCallback->m_pDocView);
     LOKDocViewPrivate& priv = getPrivate(pDocView);
 
+    //callback registered before the widget was destroyed.
+    //Use existance of lokThreadPool as flag it was torn down
+    if (!priv->lokThreadPool)
+    {
+        delete pCallback;
+        return G_SOURCE_REMOVE;
+    }
+
     switch (pCallback->m_nType)
     {
     case LOK_CALLBACK_INVALIDATE_TILES:
@@ -2627,6 +2635,13 @@ static void lok_doc_view_destroy (GtkWidget* widget)
         priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
         priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, 
nullptr, nullptr);
     }
+
+    if (priv->lokThreadPool)
+    {
+        g_thread_pool_free(priv->lokThreadPool, true, true);
+        priv->lokThreadPool = nullptr;
+    }
+
     aGuard.unlock();
 
     if (priv->m_pDocument)
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to