fix memory leak 05/37805/1
authorBoram Park <boram1288.park@samsung.com>
Mon, 6 Apr 2015 10:50:35 +0000 (19:50 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 6 Apr 2015 10:50:39 +0000 (19:50 +0900)
   When client is deleted, _e_client_del is called. And ec->pixmap becomes NULL.
   After that, when _e_mod_effect_unref is called, ec->pixmap is NULL. But the
   ref_count of pixmap is 1.

Change-Id: I6e33af1abd30bf5556bce8d300a3697e926ecf62

src/e_mod_effect.c

index c2f2745..8228494 100644 (file)
@@ -8,6 +8,7 @@ typedef struct _E_Effect_Client
 {
    E_Client *ec;
    unsigned int animating;
+   E_Pixmap *ep;
 } E_Effect_Client;
 
 static void
@@ -28,7 +29,7 @@ _e_mod_effect_ref(E_Client *ec)
 
    efc->animating ++;
    e_object_ref(E_OBJECT(ec));
-   e_pixmap_ref(ec->pixmap);
+   efc->ep = e_pixmap_ref(ec->pixmap);
 }
 
 static void
@@ -43,7 +44,7 @@ _e_mod_effect_unref(E_Client *ec)
 
    while(efc->animating)
      {
-        e_pixmap_free(ec->pixmap);
+        e_pixmap_free(efc->ep);
         if (!e_object_unref(E_OBJECT(ec)))
           {
              eina_hash_del_by_key(_effect->clients, &ec);
@@ -52,6 +53,8 @@ _e_mod_effect_unref(E_Client *ec)
 
         efc->animating --;
      }
+
+   efc->ep = NULL;
 }
 
 static void
@@ -281,6 +284,7 @@ _e_mod_effect_client_new(E_Client *ec)
    efc = E_NEW(E_Effect_Client, 1);
    efc->ec = ec;
    efc->animating = 0;
+   efc->ep = NULL;
 
    return efc;
 }