summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-08 15:26:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-10 15:28:16 +0200
commita99707d2c4f65a6a5fe160ce2b614aca273f0d2d (patch)
tree48a40d28677bb70a185edf76f76b6d57f9350419 /libreofficekit
parent015578db97bec8926441a9440de6067937f63143 (diff)
Resolves: rhbz#144437 make gnome-documents not crash the whole time
accept that once initted that LibreOffice cannot be deinitted and reinited (without lots of work), but allow the main loop to quit and restart so LOKs thread can run and exit successfully, new LOK connections will restart the main loop. The buckets of global state continues to be valid the whole time this way Change-Id: Ide54c0df2ce4065f7c192ae8c2cedfaaa2b58d72 Reviewed-on: https://gerrit.libreoffice.org/37399 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx34
1 files changed, 23 insertions, 11 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 65c5a64111f6..fd367052ddca 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2608,20 +2608,32 @@ static void lok_doc_view_destroy (GtkWidget* widget)
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->getViewsCount(priv->m_pDocument) > 1)
+ if (priv->m_pDocument)
{
- priv->m_pDocument->pClass->destroyView(priv->m_pDocument, priv->m_nViewId);
+ priv->m_pDocument->pClass->setView(priv->m_pDocument, priv->m_nViewId);
+ priv->m_pDocument->pClass->registerCallback(priv->m_pDocument, nullptr, nullptr);
}
- else
+ aGuard.unlock();
+
+ if (priv->m_pDocument)
{
- if (priv->m_pDocument)
- priv->m_pDocument->pClass->destroy (priv->m_pDocument);
- if (priv->m_pOffice)
- priv->m_pOffice->pClass->destroy (priv->m_pOffice);
+ if (priv->m_pDocument->pClass->getViewsCount(priv->m_pDocument) > 1)
+ {
+ priv->m_pDocument->pClass->destroyView(priv->m_pDocument, priv->m_nViewId);
+ }
+ else
+ {
+ if (priv->m_pDocument)
+ {
+ priv->m_pDocument->pClass->destroy (priv->m_pDocument);
+ priv->m_pDocument = nullptr;
+ }
+ if (priv->m_pOffice)
+ {
+ priv->m_pOffice->pClass->destroy (priv->m_pOffice);
+ priv->m_pOffice = nullptr;
+ }
+ }
}
GTK_WIDGET_CLASS (lok_doc_view_parent_class)->destroy (widget);