[network-manager-applet/nma-0-9-8] editor: clean up left-over validation idle sources when disposing
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/nma-0-9-8] editor: clean up left-over validation idle sources when disposing
- Date: Wed, 3 Apr 2013 20:31:00 +0000 (UTC)
commit c0bfcb573d8b3df0cb1884581e4228625c0972be
Author: Dan Williams <dcbw redhat com>
Date: Wed Apr 3 15:19:39 2013 -0500
editor: clean up left-over validation idle sources when disposing
If you were really, really quick hitting the Cancel button, the
editor would be disposed before the validation idle function
was run, resulting in a crash.
src/connection-editor/nm-connection-editor.c | 14 ++++++++++++--
src/connection-editor/nm-connection-editor.h | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index e03160d..31eb760 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -329,6 +329,11 @@ dispose (GObject *object)
g_slist_free (editor->pending_secrets_calls);
editor->pending_secrets_calls = NULL;
+ if (editor->validate_id) {
+ g_source_remove (editor->validate_id);
+ editor->validate_id = 0;
+ }
+
if (editor->connection) {
g_object_unref (editor->connection);
editor->connection = NULL;
@@ -585,7 +590,10 @@ page_changed (CEPage *page, gpointer user_data)
static gboolean
idle_validate (gpointer user_data)
{
- connection_editor_validate (NM_CONNECTION_EDITOR (user_data));
+ NMConnectionEditor *editor = NM_CONNECTION_EDITOR (user_data);
+
+ editor->validate_id = 0;
+ connection_editor_validate (editor);
return FALSE;
}
@@ -611,7 +619,9 @@ recheck_initialization (NMConnectionEditor *editor)
/* Validate the connection from an idle handler to ensure that stuff like
* GtkFileChoosers have had a chance to asynchronously find their files.
*/
- g_idle_add (idle_validate, editor);
+ if (editor->validate_id)
+ g_source_remove (editor->validate_id);
+ editor->validate_id = g_idle_add (idle_validate, editor);
}
static void
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index 43c7c3b..38300fb 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -65,6 +65,7 @@ typedef struct {
gboolean busy;
gboolean init_run;
+ guint validate_id;
} NMConnectionEditor;
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]