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.

SVN revision: 12070
This commit is contained in:
rephorm 2004-10-30 02:30:55 +00:00 committed by rephorm
parent 2b81462e95
commit 634caa3c9e
2 changed files with 9 additions and 1 deletions

View File

@ -127,6 +127,7 @@ _edje_message_new(Edje *ed, Edje_Queue queue, Edje_Message_Type type, int id)
em->type = type; em->type = type;
em->id = id; em->id = id;
em->edje->message.num++; em->edje->message.num++;
_edje_ref(em->edje);
return em; return em;
} }
@ -242,6 +243,7 @@ _edje_message_free(Edje_Message *em)
} }
} }
em->edje->message.num--; em->edje->message.num--;
_edje_unref(em->edje);
free(em); free(em);
} }

View File

@ -1482,6 +1482,7 @@ _edje_thaw(Edje *ed)
int int
_edje_block(Edje *ed) _edje_block(Edje *ed)
{ {
_edje_ref(ed);
ed->block++; ed->block++;
return ed->block; return ed->block;
} }
@ -1489,12 +1490,17 @@ _edje_block(Edje *ed)
int int
_edje_unblock(Edje *ed) _edje_unblock(Edje *ed)
{ {
int ret = 0;
if (!ed) return;
ed->block--; ed->block--;
if (ed->block == 0) if (ed->block == 0)
{ {
ed->block_break = 0; ed->block_break = 0;
} }
return ed->block; ret = ed->block;
_edje_unref(ed);
return ret;
} }
int int