[cheese/capsrework] Fix a shameful bug in the constructed call



commit c81195d88cdf2b8a8d977934bcafb6fd841ec4cc
Author: Filippo Argiolas <filippo argiolas gmail com>
Date:   Wed Dec 16 10:57:21 2009 +0100

    Fix a shameful bug in the constructed call
    
    Chaining up to parent class finalize in the constructed call wasn't
    exactly the best.

 libcheese/cheese-camera-device.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
index a7774fc..94d1db3 100644
--- a/libcheese/cheese-camera-device.c
+++ b/libcheese/cheese-camera-device.c
@@ -299,9 +299,11 @@ cheese_camera_device_constructed (GObject *object)
 {
   CheeseCameraDevice *device = CHEESE_CAMERA_DEVICE (object);
 
+
   cheese_camera_device_get_caps (device);
 
-  G_OBJECT_CLASS (cheese_camera_device_parent_class)->finalize (object);
+  if (G_OBJECT_CLASS (cheese_camera_device_parent_class)->constructed)
+    G_OBJECT_CLASS (cheese_camera_device_parent_class)->constructed (object);
 }
 
 static void
@@ -339,19 +341,23 @@ cheese_camera_device_set_property (GObject *object, guint prop_id, const GValue
 
   switch (prop_id) {
   case PROP_NAME:
-    g_free (priv->name);
+    if (priv->name)
+      g_free (priv->name);
     priv->name = g_value_dup_string (value);
     break;
   case PROP_ID:
-    g_free (priv->id);
+    if (priv->id)
+      g_free (priv->id);
     priv->id = g_value_dup_string (value);
     break;
   case PROP_FILE:
-    g_free (priv->device);
+    if (priv->device)
+      g_free (priv->device);
     priv->device = g_value_dup_string (value);
     break;
   case PROP_SRC:
-    g_free (priv->src);
+    if (priv->src)
+      g_free (priv->src);
     priv->src = g_value_dup_string (value);
     break;
   default:



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