Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_message_queue.c edje_util.c 


Log Message:


ref and unref the edje when blocking/unblocking and creating/deleting messages to 
avoid accessing free'd memory if an edje is deleted from an edje signal callback.


===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_message_queue.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- edje_message_queue.c        19 Oct 2004 09:56:14 -0000      1.11
+++ edje_message_queue.c        30 Oct 2004 02:30:55 -0000      1.12
@@ -127,6 +127,7 @@
    em->type = type;
    em->id = id;
    em->edje->message.num++;
+   _edje_ref(em->edje);
    return em;
 }
 
@@ -242,6 +243,7 @@
          }
      }
    em->edje->message.num--;
+   _edje_unref(em->edje);
    free(em);
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- edje_util.c 27 Oct 2004 19:24:42 -0000      1.43
+++ edje_util.c 30 Oct 2004 02:30:55 -0000      1.44
@@ -1482,6 +1482,7 @@
 int
 _edje_block(Edje *ed)
 {
+   _edje_ref(ed);
    ed->block++;
    return ed->block;
 }
@@ -1489,12 +1490,17 @@
 int
 _edje_unblock(Edje *ed)
 {
+   int ret = 0;
+   if (!ed) return;
+
    ed->block--;
    if (ed->block == 0)
      {
        ed->block_break = 0;
      }
-   return ed->block;
+   ret = ed->block;
+   _edje_unref(ed);
+   return ret;
 }
 
 int




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to