summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-16 15:30:10 +0100
committerAndras Timar <andras.timar@collabora.com>2017-06-27 14:02:12 +0200
commit3321b50cbcf2b1d29f1b3c430cf1c164aba343fa (patch)
tree5f2245c415f29fc87d1cce736794e732dd649103
parentce98a72ec7d69c74b97c924418682f76033bc220 (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> (cherry picked from commit c9eb6c7162a29a36f96d83c3dbe21d4e89df1470)
-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 1d87f5bd17b0..9a8c00b875b2 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:
@@ -2619,8 +2627,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)