[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - libreofficekit/source

Caolán McNamara caolanm at redhat.com
Thu Jun 22 12:30:50 UTC 2017


 libreofficekit/source/gtk/lokdocview.cxx |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

New commits:
commit c9eb6c7162a29a36f96d83c3dbe21d4e89df1470
Author: Caolán McNamara <caolanm at redhat.com>
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/38890
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index a08d93e8e3fa..0b48cf8b7373 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1132,6 +1132,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:
@@ -2584,8 +2592,19 @@ static void lok_doc_view_finalize (GObject* object)
     std::stringstream ss;
     ss << "lok::Document::setView(" << priv->m_nViewId << ")";
     g_info("%s", ss.str().c_str());
-    priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
-    priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, nullptr, nullptr);
+
+    if (priv->m_pDocument)
+    {
+        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 && priv->m_pDocument->pClass->getViewsCount(priv->m_pDocument) > 1)


More information about the Libreoffice-commits mailing list