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

New commits:
commit ec25aee171d77a2bc69e01c2dd7c8233075d2511
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/38889
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index a59d72bcc374..c42132acf8ad 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1147,6 +1147,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:
@@ -2626,6 +2634,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