[gnome-control-center] network: Add sanity checks NetDevice and NetObject



commit 234ed231384abb0b7f23db9637836592c411eba8
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Mar 18 13:24:47 2015 +0100

    network: Add sanity checks NetDevice and NetObject
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746411

 panels/network/net-device.c |    1 +
 panels/network/net-object.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index ec8be06..d96551a 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -227,6 +227,7 @@ state_changed_cb (NMDevice *device,
 NMDevice *
 net_device_get_nm_device (NetDevice *device)
 {
+        g_return_val_if_fail (NET_IS_DEVICE (device), NULL);
         return device->priv->nm_device;
 }
 
diff --git a/panels/network/net-object.c b/panels/network/net-object.c
index cc0e99a..6e59d97 100644
--- a/panels/network/net-object.c
+++ b/panels/network/net-object.c
@@ -263,9 +263,11 @@ net_object_set_property (GObject *object_,
                         g_object_add_weak_pointer (G_OBJECT (priv->remote_settings), (gpointer *) 
(&priv->remote_settings));
                 break;
         case PROP_CANCELLABLE:
+                g_assert (!priv->cancellable);
                 priv->cancellable = g_value_dup_object (value);
                 break;
         case PROP_PANEL:
+                g_assert (!priv->panel);
                 priv->panel = g_value_get_pointer (value);
                 if (priv->panel)
                         g_object_add_weak_pointer (G_OBJECT (priv->panel), (gpointer *) (&priv->panel));


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