seed_get_class_info_for_type had a logic error, causing GIBaseInfos to be unreffed...
authorRobert Carr <racarr@gnome.org>
Thu, 17 Dec 2009 20:23:39 +0000 (15:23 -0500)
committerRobert Carr <racarr@gnome.org>
Thu, 17 Dec 2009 20:23:39 +0000 (15:23 -0500)
This is obviously not a good idea and has been rectified. Closes BGO #593182

libseed/seed-gtype.c

index f5db408..839e689 100644 (file)
@@ -268,18 +268,22 @@ static GIBaseInfo *
 seed_get_class_info_for_type (GType type)
 {
   GIBaseInfo *object_info;
-
+  
+  // Note to self: Investigate the entire premise of this function.
   while ((type = g_type_parent (type)))
     {
+      GIBaseInfo *ret;
+
       object_info = g_irepository_find_by_gtype (NULL, type);
       if (object_info)
        {
-         return
-           (GIBaseInfo *) g_object_info_get_class_struct
-           ((GIObjectInfo *) object_info);
+         ret = g_object_info_get_class_struct ((GIObjectInfo *)object_info);
+         g_base_info_unref (object_info);
+         
+         return ret;
        }
-      g_base_info_unref (object_info);
     }
+  
   return NULL;
 }