Fixed 'finalize' to proper pass finalization to its parent class finalizer.
authorshort <>
Tue, 9 Sep 2003 18:50:15 +0000 (18:50 +0000)
committershort <>
Tue, 9 Sep 2003 18:50:15 +0000 (18:50 +0000)
Fixed reference counting by SharedCacheMap 'map' PrivateBcbMap.

src/libcaptive/cc/privatebcbmap.c

index b3c20e7..26544e3 100644 (file)
@@ -49,7 +49,7 @@ CaptiveSharedCacheMapObject *captive_shared_cache_map_object;
        if ((captive_shared_cache_map_object=captive_private_bcb_object->SharedCacheMap)) {
                g_assert(captive_shared_cache_map_object->map==captive_private_bcb_map_object);
                captive_shared_cache_map_object->map=NULL;
-               g_object_unref(captive_shared_cache_map_object);
+               g_object_unref(captive_shared_cache_map_object);        /* 'map' disconnected. */
                }
 
        G_OBJECT_CLASS(captive_private_bcb_map_object_parent_class)->finalize((GObject *)captive_private_bcb_map_object);
@@ -60,7 +60,7 @@ static void captive_private_bcb_map_object_class_init(CaptivePrivateBcbMapObject
 {
 GObjectClass *gobject_class=G_OBJECT_CLASS(class);
 
-       captive_private_bcb_map_object_parent_class=g_type_class_ref(G_TYPE_OBJECT);
+       captive_private_bcb_map_object_parent_class=g_type_class_ref(g_type_parent(G_TYPE_FROM_CLASS(class)));
        gobject_class->finalize=(void (*)(GObject *object))captive_private_bcb_map_object_finalize;
 }
 
@@ -109,6 +109,7 @@ CaptivePrivateBcbMapObject *captive_private_bcb_map_object;
 
        g_assert(captive_shared_cache_map_object->map==NULL);
        captive_shared_cache_map_object->map=captive_private_bcb_map_object;
+       g_object_ref(captive_shared_cache_map_object);  /* 'map' connected. */
 
        return captive_private_bcb_map_object;
 }