From ec7562fddfd94813bce7560ce03ffe9a3c416de7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 31 Oct 2019 09:02:52 -0400 Subject: [PATCH] tests/spec: use wrefs to automatically unset global pointers Summary: these may end up being reused in the future, so unset them only on object destruction Depends on D10571 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10572 --- src/tests/elementary/spec/efl_ui_spec_suite.c | 10 ++-------- src/tests/elementary/spec/generator.py | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.c b/src/tests/elementary/spec/efl_ui_spec_suite.c index 2952e23585..92858cb69b 100644 --- a/src/tests/elementary/spec/efl_ui_spec_suite.c +++ b/src/tests/elementary/spec/efl_ui_spec_suite.c @@ -30,14 +30,8 @@ _setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass) ck_assert(win); ck_assert(widget); -} - -static void -_shutdown_fixture(void) -{ - //We just NULL them out, shutdown will delete them - win = NULL; - widget = NULL; + efl_wref_add(widget, &widget); + efl_wref_add(win, &win); } Eo* diff --git a/src/tests/elementary/spec/generator.py b/src/tests/elementary/spec/generator.py index daf2e61cfc..f831654885 100755 --- a/src/tests/elementary/spec/generator.py +++ b/src/tests/elementary/spec/generator.py @@ -12,7 +12,7 @@ tcase_gen_template = """ static void {}(TCase *tc) {{ - tcase_add_checked_fixture(tc, _{}_fixture, _shutdown_fixture); + tcase_add_checked_fixture(tc, _{}_fixture, NULL); tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); {}(tc); }}