Revert "[Genlist] Fix item class unref/free usage"
authorTae-Hwan Kim <the81.kim@samsung.com>
Tue, 7 May 2013 12:08:10 +0000 (21:08 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Wed, 12 Jun 2013 04:54:53 +0000 (13:54 +0900)
This reverts commit b33d66f1b64bed4042ac6e9ee8ac0d599f1f4370.

src/lib/elm_genlist.c

index afaea43..c56f5d7 100644 (file)
@@ -6967,6 +6967,7 @@ elm_genlist_item_class_new(void)
 
    itc->version = CLASS_ALLOCATED;
    itc->refcount = 1;
+   itc->delete_me = EINA_FALSE;
 
    return itc;
 }
@@ -6976,6 +6977,7 @@ elm_genlist_item_class_free(Elm_Genlist_Item_Class *itc)
 {
    if (itc && (itc->version == CLASS_ALLOCATED))
      {
+        itc->delete_me = EINA_TRUE;
         itc->func.text_get = NULL;
         itc->func.content_get = NULL;
         itc->func.state_get = NULL;
@@ -7005,7 +7007,8 @@ elm_genlist_item_class_unref(Elm_Genlist_Item_Class *itc)
    if (itc && (itc->version == CLASS_ALLOCATED))
      {
         if (itc->refcount > 0) itc->refcount--;
-        if (!itc->refcount) elm_genlist_item_class_free(itc);
+        if (itc->delete_me && (!itc->refcount))
+          elm_genlist_item_class_free(itc);
      }
 }