[gnome-control-center] network: Prevent a crash when a device is removed and then re-added
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Prevent a crash when a device is removed and then re-added
- Date: Mon, 23 Jul 2012 09:46:23 +0000 (UTC)
commit 08532a3a86e2a8ee6621c857281cf9a06bc77545
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 23 10:14:31 2012 +0100
network: Prevent a crash when a device is removed and then re-added
panels/network/net-device.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index 5f01410..c53c909 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -40,6 +40,7 @@
struct _NetDevicePrivate
{
NMDevice *nm_device;
+ guint changed_id;
};
enum {
@@ -281,11 +282,15 @@ net_device_set_property (GObject *device_,
switch (prop_id) {
case PROP_DEVICE:
+ if (priv->changed_id != 0) {
+ g_signal_handler_disconnect (priv->nm_device,
+ priv->changed_id);
+ }
priv->nm_device = g_value_dup_object (value);
- g_signal_connect (priv->nm_device,
- "state-changed",
- G_CALLBACK (state_changed_cb),
- net_device);
+ priv->changed_id = g_signal_connect (priv->nm_device,
+ "state-changed",
+ G_CALLBACK (state_changed_cb),
+ net_device);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (net_device, prop_id, pspec);
@@ -299,6 +304,10 @@ net_device_finalize (GObject *object)
NetDevice *device = NET_DEVICE (object);
NetDevicePrivate *priv = device->priv;
+ if (priv->changed_id != 0) {
+ g_signal_handler_disconnect (priv->nm_device,
+ priv->changed_id);
+ }
if (priv->nm_device != NULL)
g_object_unref (priv->nm_device);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]