summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2018-06-27 07:50:30 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-27 07:50:31 -0400
commitdf652673febd8617d3f458a5c14478534e927940 (patch)
tree60785fae3f4d250c9c460c36c70373ec52e3de7b /src
parentf23344733f1e09b4b919647f0a49f9fdc9212804 (diff)
evas: move clearing cows to right place.
Summary: Evas is child of main loop now, so evas is deleted when main loop is quitted. In case of not calling evas_free() explicitly by app side, a crash occurs. So move clearing cows to below ecore_shutdown(). Test Plan: //Compile with: //gcc evas_test.c -o evas_test `pkg-config --cflags --libs ecore evas` #include <Evas.h> #include <Ecore.h> Eina_Bool _timer_cb (void *data) { ecore_main_loop_quit(); return 0; } int main(int argc, char *argv[]) { evas_init(); Evas *evas = evas_new(); Evas_Object *obj = evas_object_box_add(evas); Evas_Object *rect = evas_object_rectangle_add(evas); evas_object_color_set(rect, 255, 255, 255, 255); evas_object_resize(rect, 300, 400); evas_object_show(rect); evas_object_box_append(obj, rect); evas_object_show(obj); ecore_timer_add(2.0, _timer_cb, NULL); ecore_main_loop_begin(); evas_shutdown(); return 0; } Reviewers: devilhorns, cedric, jpeg, id213sin, woohyun, zmike Reviewed By: zmike Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6346
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/lib/ecore_evas/ecore_evas.c2
-rw-r--r--src/lib/evas/canvas/evas_main.c20
-rw-r--r--src/tests/evas/evas_suite.c1
-rw-r--r--src/tests/evas/evas_suite.h1
-rw-r--r--src/tests/evas/evas_test_new.c21
6 files changed, 36 insertions, 10 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 2caa195ab1..deab83005d 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -2434,6 +2434,7 @@ TESTS += tests/evas/evas_suite
2434tests_evas_evas_suite_SOURCES = \ 2434tests_evas_evas_suite_SOURCES = \
2435tests/evas/evas_suite.c \ 2435tests/evas/evas_suite.c \
2436tests/evas/evas_test_init.c \ 2436tests/evas/evas_test_init.c \
2437tests/evas/evas_test_new.c \
2437tests/evas/evas_test_object.c \ 2438tests/evas/evas_test_object.c \
2438tests/evas/evas_test_object_smart.c \ 2439tests/evas/evas_test_object_smart.c \
2439tests/evas/evas_test_textblock.c \ 2440tests/evas/evas_test_textblock.c \
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 52dfc36db1..88dd59ee7c 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -667,8 +667,8 @@ ecore_evas_shutdown(void)
667 667
668 eina_log_domain_unregister(_ecore_evas_log_dom); 668 eina_log_domain_unregister(_ecore_evas_log_dom);
669 _ecore_evas_log_dom = -1; 669 _ecore_evas_log_dom = -1;
670 evas_shutdown();
671 ecore_shutdown(); 670 ecore_shutdown();
671 evas_shutdown();
672 672
673 return _ecore_evas_init_count; 673 return _ecore_evas_init_count;
674} 674}
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 2849f21ceb..50555c4ea1 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -155,9 +155,19 @@ evas_shutdown(void)
155#endif 155#endif
156 evas_cache_vg_shutdown(); 156 evas_cache_vg_shutdown();
157 157
158 evas_font_path_global_clear();
159
160 evas_filter_shutdown();
161
162 evas_thread_shutdown();
163 _evas_preload_thread_shutdown();
164 evas_async_events_shutdown();
165 evas_module_shutdown();
166
167 ecore_shutdown();
168
158 _efl_gfx_map_shutdown(); 169 _efl_gfx_map_shutdown();
159 170
160 evas_font_path_global_clear();
161 eina_cow_del(evas_object_proxy_cow); 171 eina_cow_del(evas_object_proxy_cow);
162 eina_cow_del(evas_object_map_cow); 172 eina_cow_del(evas_object_map_cow);
163 eina_cow_del(evas_object_state_cow); 173 eina_cow_del(evas_object_state_cow);
@@ -172,17 +182,9 @@ evas_shutdown(void)
172 evas_object_image_load_opts_cow = NULL; 182 evas_object_image_load_opts_cow = NULL;
173 evas_object_image_state_cow = NULL; 183 evas_object_image_state_cow = NULL;
174 184
175 evas_filter_shutdown();
176 eina_cow_del(evas_object_mask_cow); 185 eina_cow_del(evas_object_mask_cow);
177 evas_object_mask_cow = NULL; 186 evas_object_mask_cow = NULL;
178 187
179 evas_thread_shutdown();
180 _evas_preload_thread_shutdown();
181 evas_async_events_shutdown();
182 evas_module_shutdown();
183
184 ecore_shutdown();
185
186#ifdef BUILD_LOADER_EET 188#ifdef BUILD_LOADER_EET
187 eet_shutdown(); 189 eet_shutdown();
188#endif 190#endif
diff --git a/src/tests/evas/evas_suite.c b/src/tests/evas/evas_suite.c
index a5c27d5dfa..e84d23f5dc 100644
--- a/src/tests/evas/evas_suite.c
+++ b/src/tests/evas/evas_suite.c
@@ -10,6 +10,7 @@
10 10
11static const Efl_Test_Case etc[] = { 11static const Efl_Test_Case etc[] = {
12 { "Evas", evas_test_init }, 12 { "Evas", evas_test_init },
13 { "Evas New", evas_test_new },
13 { "Object", evas_test_object }, 14 { "Object", evas_test_object },
14 { "Object Textblock", evas_test_textblock }, 15 { "Object Textblock", evas_test_textblock },
15 { "Object Text", evas_test_text }, 16 { "Object Text", evas_test_text },
diff --git a/src/tests/evas/evas_suite.h b/src/tests/evas/evas_suite.h
index f7feb2ccbe..0da47fe13f 100644
--- a/src/tests/evas/evas_suite.h
+++ b/src/tests/evas/evas_suite.h
@@ -4,6 +4,7 @@
4#include <check.h> 4#include <check.h>
5#include "../efl_check.h" 5#include "../efl_check.h"
6void evas_test_init(TCase *tc); 6void evas_test_init(TCase *tc);
7void evas_test_new(TCase *tc);
7void evas_test_object(TCase *tc); 8void evas_test_object(TCase *tc);
8void evas_test_textblock(TCase *tc); 9void evas_test_textblock(TCase *tc);
9void evas_test_text(TCase *tc); 10void evas_test_text(TCase *tc);
diff --git a/src/tests/evas/evas_test_new.c b/src/tests/evas/evas_test_new.c
new file mode 100644
index 0000000000..c95c43a230
--- /dev/null
+++ b/src/tests/evas/evas_test_new.c
@@ -0,0 +1,21 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <stdio.h>
6
7#include <Evas.h>
8
9#include "evas_suite.h"
10
11EFL_START_TEST(evas_free_none)
12{
13 Evas *evas = evas_new();
14 Evas_Object *obj = evas_object_rectangle_add(evas);
15}
16EFL_END_TEST
17
18void evas_test_new(TCase *tc)
19{
20 tcase_add_test(tc, evas_free_none);
21}