summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-15 17:10:47 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-15 18:07:44 +0200
commit8090b53e0e16e9aef95f2f5557985f7c2e7c69f3 (patch)
tree7d233c2d5dd102ba0cc28b18c4bb163478345ce8 /libreofficekit
parentc415f37a40fdca0492ef0bdedbbf4ffcd567b386 (diff)
lokdocview: ignore notifications on view shutdown
Callbacks are processed on idle on the main thread, so by the time we parse them, possibly the widget is already gone, avoid that problem. Change-Id: Ie8e16423d1ffe087e0dd21425026f7a5d644c27b
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0c9d13535d08..198dfd870472 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2394,6 +2394,15 @@ static void lok_doc_view_finalize (GObject* object)
LOKDocView* pDocView = LOK_DOC_VIEW (object);
LOKDocViewPrivate& priv = getPrivate(pDocView);
+ // Ignore notifications sent to this view on shutdown.
+ std::unique_lock<std::mutex> aGuard(g_aLOKMutex);
+ 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);
+ aGuard.unlock();
+
if (priv->m_pDocument && priv->m_pDocument->pClass->getViews(priv->m_pDocument) > 1)
{
priv->m_pDocument->pClass->destroyView(priv->m_pDocument, priv->m_nViewId);