[evince/gnome-3-32] ev-page-action-widget: disconnect notify::document signal in finalize
- From: Jason Crain <jcrain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/gnome-3-32] ev-page-action-widget: disconnect notify::document signal in finalize
- Date: Tue, 23 Apr 2019 05:54:41 +0000 (UTC)
commit 6880e45250b6a16846aae38dfea4a4db23da2fc6
Author: Jason Crain <jcrain src gnome org>
Date: Mon Apr 22 17:53:56 2019 -0600
ev-page-action-widget: disconnect notify::document signal in finalize
EvPageActionWidget listens for the notify::document signal, but does not
disconnect the signal in finalize, so if you enter and exit fullscreen
mode, which creates and destroys a fullscreen toolbar, then reload the
document, this results in a calling the signal handler with an invalid
EvPageActionWidget pointer.
Disconnect the notify::document signal when EvPageActionWidget is
finalized.
Fixes #789
libmisc/ev-page-action-widget.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c
index 0d2e10d5..5274cb73 100644
--- a/libmisc/ev-page-action-widget.c
+++ b/libmisc/ev-page-action-widget.c
@@ -47,7 +47,8 @@ struct _EvPageActionWidget
GtkWidget *entry;
GtkWidget *label;
- guint signal_id;
+ gulong signal_id;
+ gulong notify_document_signal_id;
GtkTreeModel *filter_model;
GtkTreeModel *model;
};
@@ -309,9 +310,11 @@ ev_page_action_widget_set_model (EvPageActionWidget *action_widget,
(gpointer)&action_widget->doc_model);
ev_page_action_widget_set_document (action_widget, ev_document_model_get_document (model));
- g_signal_connect (model, "notify::document",
- G_CALLBACK (ev_page_action_widget_document_changed_cb),
- action_widget);
+
+ action_widget->notify_document_signal_id =
+ g_signal_connect (model, "notify::document",
+ G_CALLBACK (ev_page_action_widget_document_changed_cb),
+ action_widget);
}
static void
@@ -325,6 +328,11 @@ ev_page_action_widget_finalize (GObject *object)
action_widget->signal_id);
action_widget->signal_id = 0;
}
+ if (action_widget->notify_document_signal_id > 0) {
+ g_signal_handler_disconnect (action_widget->doc_model,
+ action_widget->notify_document_signal_id);
+ action_widget->notify_document_signal_id = 0;
+ }
g_object_remove_weak_pointer (G_OBJECT (action_widget->doc_model),
(gpointer)&action_widget->doc_model);
action_widget->doc_model = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]