summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-16 15:30:10 +0100
committerMichael Stahl <mstahl@redhat.com>2017-06-22 14:30:26 +0200
commitc9eb6c7162a29a36f96d83c3dbe21d4e89df1470 (patch)
tree21ea71c0b0f181d19830306ce422ceeb0b2a4e0d /libreofficekit
parent35e62d9e649badfe00d0b8ea4c307d3fbbda735c (diff)
Resolves: rhbz#1454693 segv if tiled rendering is interrupted
Change-Id: I1131f246c43806adb8a83f6eeafca2b734851a0e Reviewed-on: https://gerrit.libreoffice.org/38890 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx23
1 files changed, 21 insertions, 2 deletions
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)