[network-manager-applet] editor: correction of CEPolkitButton handling during permissions call (rh #603566)



commit 9737403b155d303cffbd08fe4a84c510ac995c8b
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Wed Jul 7 17:26:20 2010 +0200

    editor: correction of CEPolkitButton handling during permissions call (rh #603566)
    
    Commit 5978047977a17f35d9a3961023143506a73899f8 cause crashes of nm-connection-editor
    when changing a system connection (clicking Apply button). It didn't add PermInfo
    structure to perm_calls list.
    Even if this commit fixes the crash, the code isn't still 100% correct because the
    get_permissions_cb() gets called after finalize() (and thus info->disposed as well as
    the whole object should not be used).

 src/connection-editor/ce-polkit-button.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/connection-editor/ce-polkit-button.c b/src/connection-editor/ce-polkit-button.c
index d9c5efc..aedcd7d 100644
--- a/src/connection-editor/ce-polkit-button.c
+++ b/src/connection-editor/ce-polkit-button.c
@@ -190,10 +190,14 @@ static void
 check_permissions_cb (NMRemoteSettingsSystem *settings, CEPolkitButton *self)
 {
 	PermInfo *info;
+	CEPolkitButtonPrivate *priv;
 
 	info = g_malloc0 (sizeof (PermInfo));
 	info->self = self;
 
+	priv = CE_POLKIT_BUTTON_GET_PRIVATE (info->self);
+	priv->perm_calls = g_slist_append (priv->perm_calls, info);
+
 	/* recheck permissions */
 	nm_settings_system_interface_get_permissions (NM_SETTINGS_SYSTEM_INTERFACE (settings),
 	                                              get_permissions_cb,
@@ -261,7 +265,6 @@ dispose (GObject *object)
 	/* Mark any ongoing permissions calls as disposed */
 	for (iter = priv->perm_calls; iter; iter = g_slist_next (iter))
 		((PermInfo *) iter->data)->disposed = TRUE;
-	g_slist_free (priv->perm_calls);
 
 	if (priv->check_id)
 		g_signal_handler_disconnect (priv->settings, priv->check_id);
@@ -282,6 +285,7 @@ finalize (GObject *object)
 	g_free (priv->auth_label);
 	g_free (priv->tooltip);
 	g_free (priv->auth_tooltip);
+	g_slist_free (priv->perm_calls);
 
 	G_OBJECT_CLASS (ce_polkit_button_parent_class)->finalize (object);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]