[network-manager-applet] libnma: take weak-ref to passwd_entry in PopupMenuItemInfo
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] libnma: take weak-ref to passwd_entry in PopupMenuItemInfo
- Date: Fri, 11 Sep 2015 11:43:34 +0000 (UTC)
commit eaf99061fba3cde9b94d3b802ff0e7d17bdfd41b
Author: Thomas Haller <thaller redhat com>
Date: Fri Sep 11 12:37:15 2015 +0200
libnma: take weak-ref to passwd_entry in PopupMenuItemInfo
src/libnm-gtk/nm-ui-utils.c | 9 +++++++--
src/libnma/nma-ui-utils.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c
index bfc5345..21ad099 100644
--- a/src/libnm-gtk/nm-ui-utils.c
+++ b/src/libnm-gtk/nm-ui-utils.c
@@ -715,7 +715,6 @@ menu_item_to_secret_flags (MenuItem item)
case ITEM_STORAGE_SYSTEM:
default:
break;
-
}
return flags;
}
@@ -735,6 +734,8 @@ popup_menu_item_info_destroy (gpointer data, GClosure *closure)
if (info->setting)
g_object_unref (info->setting);
g_clear_pointer (&info->password_flags_name, g_free);
+ if (info->passwd_entry)
+ g_object_remove_weak_pointer (G_OBJECT (info->passwd_entry), (gpointer *)
&info->passwd_entry);
g_slice_free (PopupMenuItemInfo, info);
}
@@ -754,7 +755,8 @@ activate_menu_item_cb (GtkMenuItem *menuitem, gpointer user_data)
flags, NULL);
/* Change icon */
- change_password_storage_icon (info->passwd_entry, info->item_number);
+ if (info->passwd_entry)
+ change_password_storage_icon (info->passwd_entry, info->item_number);
}
}
@@ -773,6 +775,9 @@ popup_menu_item_info_register (GtkWidget *item,
info->item_number = item_number;
info->passwd_entry = passwd_entry;
+ if (info->passwd_entry)
+ g_object_add_weak_pointer (G_OBJECT (info->passwd_entry), (gpointer *) &info->passwd_entry);
+
g_signal_connect_data (item, "activate",
G_CALLBACK (activate_menu_item_cb),
info,
diff --git a/src/libnma/nma-ui-utils.c b/src/libnma/nma-ui-utils.c
index 678ffe1..88749de 100644
--- a/src/libnma/nma-ui-utils.c
+++ b/src/libnma/nma-ui-utils.c
@@ -150,7 +150,6 @@ menu_item_to_secret_flags (MenuItem item)
case ITEM_STORAGE_SYSTEM:
default:
break;
-
}
return flags;
}
@@ -170,6 +169,8 @@ popup_menu_item_info_destroy (gpointer data, GClosure *closure)
if (info->setting)
g_object_unref (info->setting);
g_clear_pointer (&info->password_flags_name, g_free);
+ if (info->passwd_entry)
+ g_object_remove_weak_pointer (G_OBJECT (info->passwd_entry), (gpointer *)
&info->passwd_entry);
g_slice_free (PopupMenuItemInfo, info);
}
@@ -189,7 +190,8 @@ activate_menu_item_cb (GtkMenuItem *menuitem, gpointer user_data)
flags, NULL);
/* Change icon */
- change_password_storage_icon (info->passwd_entry, info->item_number);
+ if (info->passwd_entry)
+ change_password_storage_icon (info->passwd_entry, info->item_number);
}
}
@@ -208,6 +210,9 @@ popup_menu_item_info_register (GtkWidget *item,
info->item_number = item_number;
info->passwd_entry = passwd_entry;
+ if (info->passwd_entry)
+ g_object_add_weak_pointer (G_OBJECT (info->passwd_entry), (gpointer *) &info->passwd_entry);
+
g_signal_connect_data (item, "activate",
G_CALLBACK (activate_menu_item_cb),
info,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]