summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas/ecore_evas.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-06-14 16:43:23 -0700
committerCedric BAIL <cedric.bail@free.fr>2019-07-12 09:54:21 -0700
commit5847886a3fdb7c470bd55e215b822bbbaf109080 (patch)
tree8cb26fcc151ec5652da32f1ae19db598240d06a4 /src/lib/ecore_evas/ecore_evas.c
parent382c58018272c6773a5e83ec4ee9f14b1318eab7 (diff)
ecore_evas: on internal Evas canvas uncontrolled death, properly clean up Ecore_Evas.
This allow evas test to work with an Ecore_Evas directly. It prevent leaking of memory in the case of half destroying Ecore_Evas. Reviewed-by: Hermet Park <hermetpark@gmail.com> Differential Revision: https://phab.enlightenment.org/D9104
Diffstat (limited to 'src/lib/ecore_evas/ecore_evas.c')
-rw-r--r--src/lib/ecore_evas/ecore_evas.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 3e12ab5..672b7c4 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -77,6 +77,8 @@ static void _ecore_evas_animator_freeze(Ecore_Animator *animator);
77static void _ecore_evas_animator_thaw(Ecore_Animator *animator); 77static void _ecore_evas_animator_thaw(Ecore_Animator *animator);
78static void *_ecore_evas_animator_del(Ecore_Animator *animator); 78static void *_ecore_evas_animator_del(Ecore_Animator *animator);
79 79
80static void _ecore_evas_event_del(void *data, const Efl_Event *ev EINA_UNUSED);
81
80static void 82static void
81_ecore_evas_focus_out_dispatch(Ecore_Evas *ee, Efl_Input_Device *seat) 83_ecore_evas_focus_out_dispatch(Ecore_Evas *ee, Efl_Input_Device *seat)
82{ 84{
@@ -3432,6 +3434,12 @@ _ecore_evas_free(Ecore_Evas *ee)
3432 Efl_Input_Device *dev; 3434 Efl_Input_Device *dev;
3433 Ecore_Evas_Interface *iface; 3435 Ecore_Evas_Interface *iface;
3434 3436
3437 if (ee->self_del)
3438 {
3439 efl_event_callback_del(ee->evas, EFL_EVENT_INVALIDATE, _ecore_evas_event_del, ee);
3440 ee->self_del = EINA_FALSE;
3441 }
3442
3435 ee->deleted = EINA_TRUE; 3443 ee->deleted = EINA_TRUE;
3436 if (ee->refcount > 0) return; 3444 if (ee->refcount > 0) return;
3437 3445
@@ -3494,7 +3502,7 @@ _ecore_evas_free(Ecore_Evas *ee)
3494 ee->prop.wm_rot.manual_mode.timer = NULL; 3502 ee->prop.wm_rot.manual_mode.timer = NULL;
3495 eina_hash_free(ee->prop.cursors); 3503 eina_hash_free(ee->prop.cursors);
3496 ee->prop.cursors = NULL; 3504 ee->prop.cursors = NULL;
3497 evas_free(ee->evas); 3505 if (!ee->evas_dying) evas_free(ee->evas);
3498 ee->evas = NULL; 3506 ee->evas = NULL;
3499 ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE); 3507 ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE);
3500 ee->driver = NULL; 3508 ee->driver = NULL;
@@ -5264,6 +5272,15 @@ ecore_evas_evas_new(Ecore_Evas *ee, int w, int h)
5264 return e; 5272 return e;
5265} 5273}
5266 5274
5275static void
5276_ecore_evas_event_del(void *data, const Efl_Event *ev EINA_UNUSED)
5277{
5278 Ecore_Evas *ee = data;
5279
5280 ee->evas_dying = EINA_TRUE;
5281 ecore_evas_free(ee);
5282}
5283
5267EAPI void 5284EAPI void
5268ecore_evas_done(Ecore_Evas *ee, Eina_Bool single_window) 5285ecore_evas_done(Ecore_Evas *ee, Eina_Bool single_window)
5269{ 5286{
@@ -5277,6 +5294,9 @@ ecore_evas_done(Ecore_Evas *ee, Eina_Bool single_window)
5277 5294
5278 if (single_window) 5295 if (single_window)
5279 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 5296 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
5297
5298 efl_event_callback_add(ee->evas, EFL_EVENT_INVALIDATE, _ecore_evas_event_del, ee);
5299 ee->self_del = EINA_TRUE;
5280} 5300}
5281 5301
5282static Ecore_Animator * 5302static Ecore_Animator *