summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-24 21:13:42 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-25 13:04:33 +0100
commit2c658ae4fb9d24b6c63dce20af1c244d25862357 (patch)
treec6b61003664a1586558367628b49b059f04a332c /libreofficekit
parent4171e2fdb29c728a4a74764b73ba5cbf53feebda (diff)
LOK DocView: clean up document on exit.
Otherwise lock files etc. aren't cleaned up, which isn't particularly nice should when then opening the file in normal LibreOffice. Change-Id: I822b6fb582473674371a4c1d403d5a05adb7ea6b
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 99f2b1592ce3..bf86679a7abb 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -17,6 +17,15 @@
static void lok_docview_class_init( LOKDocViewClass* pClass );
static void lok_docview_init( LOKDocView* pDocView );
+// We specifically need to destroy the document when closing in order to ensure
+// that lock files etc. are cleaned up.
+void lcl_onDestroy( LOKDocView* pDocView, gpointer pData )
+{
+ (void) pData;
+ pDocView->pDocument->pClass->destroy( pDocView->pDocument );
+ pDocView->pDocument = 0;
+}
+
SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type()
{
static guint lok_docview_type = 0;
@@ -70,6 +79,9 @@ static void lok_docview_init( LOKDocView* pDocView )
pDocView->pDocument = 0;
pDocView->fZoom = 1;
+
+ gtk_signal_connect( GTK_OBJECT(pDocView), "destroy",
+ GTK_SIGNAL_FUNC(lcl_onDestroy), NULL );
}
SAL_DLLPUBLIC_EXPORT GtkWidget* lok_docview_new( LibreOfficeKit* pOffice )