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
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user