diff options
author | Not Zed <NotZed@Ximian.com> | 2003-03-18 16:51:31 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-03-18 16:51:31 +0800 |
commit | ef8e2ea6e20209bbdbac1d2944e9027a6c37a0cb (patch) | |
tree | d7c3bb2b314984eca08eb91fb15cd415f510f6de /addressbook/gui/component | |
parent | 962307293176c46e0f39ac9c0639eacf584a50c4 (diff) | |
download | gsoc2013-evolution-ef8e2ea6e20209bbdbac1d2944e9027a6c37a0cb.tar.gz gsoc2013-evolution-ef8e2ea6e20209bbdbac1d2944e9027a6c37a0cb.tar.zst gsoc2013-evolution-ef8e2ea6e20209bbdbac1d2944e9027a6c37a0cb.zip |
disconnect/keep track of search result signal id. (e_select_names_init):
2003-03-18 Not Zed <NotZed@Ximian.com>
* gui/component/select-names/e-select-names.c (set_book,
addressbook_model_set_uri): disconnect/keep track of search result
signal id.
(e_select_names_init): Keep track of various signals, particularly
status signal.
(e_select_names_dispose): disconnect from any signals that are
still active. Fixes crash for #38202.
svn path=/trunk/; revision=20334
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.c | 29 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.h | 4 |
2 files changed, 28 insertions, 5 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 51af18c78f..9be940ce8f 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -122,6 +122,11 @@ search_result (EAddressbookModel *model, EBookViewStatus status, ESelectNames *e static void set_book(EBook *book, EBookStatus status, ESelectNames *esn) { + if (esn->search_id) { + g_signal_handler_disconnect(esn->model, esn->search_id); + esn->search_id = 0; + } + g_object_set(esn->model, "book", book, NULL); @@ -151,9 +156,11 @@ addressbook_model_set_uri(ESelectNames *e_select_names, EAddressbookModel *model book = e_book_new(); - g_signal_connect (model, - "search_result", G_CALLBACK (search_result), - e_select_names); + if (e_select_names->search_id) + g_signal_handler_disconnect(model, e_select_names->search_id); + e_select_names->search_id = g_signal_connect (model, + "search_result", G_CALLBACK (search_result), + e_select_names); g_object_ref(e_select_names); g_object_ref(model); @@ -520,8 +527,8 @@ e_select_names_init (ESelectNames *e_select_names) if (e_select_names->status_message && !GTK_IS_LABEL (e_select_names->status_message)) e_select_names->status_message = NULL; if (e_select_names->status_message) { - g_signal_connect (e_select_names->model, "status_message", - G_CALLBACK (status_message), e_select_names); + e_select_names->status_id = g_signal_connect (e_select_names->model, "status_message", + G_CALLBACK (status_message), e_select_names); g_object_weak_ref (G_OBJECT (e_select_names->status_message), clear_widget, &e_select_names->status_message); } @@ -604,6 +611,18 @@ e_select_names_dispose (GObject *object) { ESelectNames *e_select_names = E_SELECT_NAMES(object); + printf("eselectnames dispose\n"); + + if (e_select_names->status_id) { + g_signal_handler_disconnect(e_select_names->model, e_select_names->status_id); + e_select_names->status_id = 0; + } + + if (e_select_names->search_id) { + g_signal_handler_disconnect(e_select_names->model, e_select_names->search_id); + e_select_names->search_id = 0; + } + if (e_select_names->gui) { g_object_unref(e_select_names->gui); e_select_names->gui = NULL; diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h index bbed1d77ee..ccf4eebd5f 100644 --- a/addressbook/gui/component/select-names/e-select-names.h +++ b/addressbook/gui/component/select-names/e-select-names.h @@ -73,6 +73,10 @@ struct _ESelectNames GtkWidget *status_message; char *def; ESelectNamesFolder *current_folder; + + /* signal handlers */ + gulong status_id; + gulong search_id; }; struct _ESelectNamesClass |