ecore_evas: prevent double free evas.

When user manually free the ecore evas,
it could delete evas internally,
then evas_invalidate would be triggered,
invalidate callback would try free evas again,
this causes double free evas.

TEST SCENARIO:
   ee = ecore_evas_new(...);
   ...
   ecore_evas_free(ee);
      -> free evas
         -> invalidated cb
            -> free evas (**double free)

This is a regression bug by 5847886a3f
This commit is contained in:
Hermet Park 2019-07-26 16:49:45 +09:00
parent e40f666807
commit 24a49c8938
1 changed files with 6 additions and 1 deletions

View File

@ -3502,7 +3502,11 @@ _ecore_evas_free(Ecore_Evas *ee)
ee->prop.wm_rot.manual_mode.timer = NULL;
eina_hash_free(ee->prop.cursors);
ee->prop.cursors = NULL;
if (!ee->evas_dying) evas_free(ee->evas);
if (!ee->evas_dying)
{
ee->evas_dying = EINA_TRUE;
evas_free(ee->evas);
}
ee->evas = NULL;
ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
ee->driver = NULL;
@ -5276,6 +5280,7 @@ static void
_ecore_evas_event_del(void *data, const Efl_Event *ev EINA_UNUSED)
{
Ecore_Evas *ee = data;
if (ee->evas_dying) return;
ee->evas_dying = EINA_TRUE;
ecore_evas_free(ee);