summaryrefslogtreecommitdiff
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-21 10:40:13 +0200
commit0f42ed98b2ca61917c98a3b5f794a80716e589de (patch)
treeae33e671a1d839f2ac52494f0ddbc2f5c64b76e8
parent25ec228ab074fe9c5979353a925f5ce71c2721f0 (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 (cherry picked from commit 8090b53e0e16e9aef95f2f5557985f7c2e7c69f3)
-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 cce13ed9b9d0..43016dddd847 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2379,6 +2379,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);