diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-05 14:34:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-05-09 09:29:50 +0200 |
commit | c45660df336a640f0f9d4290b881548d25c9db9d (patch) | |
tree | a878b0a2202318d9a9c0ca8050796e4c60a794aa /libreofficekit | |
parent | 53082fcd1b1cccf7ef0c3cb1bef8e747c4e88a61 (diff) |
rhbz#1444437 gnome-documents finalize may not occur immediately
when LOK Widget is destroyed, it may instead happen during GC of javascript,
like in the in gnome-documents case, but "destroy" will be called promptly. So
close documents and office in destroy, not finalize
Change-Id: I1dd7b828839894cb2d87f5c087194fe458ca22f0
Reviewed-on: https://gerrit.libreoffice.org/37398
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.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 1effc335aed4..65c5a64111f6 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -2595,9 +2595,12 @@ static gboolean lok_doc_view_draw (GtkWidget* pWidget, cairo_t* pCairo) return FALSE; } -static void lok_doc_view_finalize (GObject* object) +//rhbz#1444437 finalize may not occur immediately when this widget is destroyed +//it may happen during GC of javascript, e.g. in gnome-documents but "destroy" +//will be called promptly, so close documents in destroy, not finalize +static void lok_doc_view_destroy (GtkWidget* widget) { - LOKDocView* pDocView = LOK_DOC_VIEW (object); + LOKDocView* pDocView = LOK_DOC_VIEW (widget); LOKDocViewPrivate& priv = getPrivate(pDocView); // Ignore notifications sent to this view on shutdown. @@ -2620,6 +2623,15 @@ static void lok_doc_view_finalize (GObject* object) if (priv->m_pOffice) priv->m_pOffice->pClass->destroy (priv->m_pOffice); } + + GTK_WIDGET_CLASS (lok_doc_view_parent_class)->destroy (widget); +} + +static void lok_doc_view_finalize (GObject* object) +{ + LOKDocView* pDocView = LOK_DOC_VIEW (object); + LOKDocViewPrivate& priv = getPrivate(pDocView); + delete priv.m_pImpl; priv.m_pImpl = nullptr; @@ -2670,6 +2682,7 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass) pWidgetClass->key_press_event = signalKey; pWidgetClass->key_release_event = signalKey; pWidgetClass->motion_notify_event = lok_doc_view_signal_motion; + pWidgetClass->destroy = lok_doc_view_destroy; /** * LOKDocView:lopath: |