diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-06-10 16:30:07 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2018-06-10 17:01:33 +0200 |
commit | d1e1adf0bc4fadb401c778f98110c9ee49540a2c (patch) | |
tree | e32888121f62eea63effe8eb071f7fdcc4219e07 /src/lib/efl | |
parent | 03e0310a82b440602c85424b36e1955e84c9ffab (diff) |
edje: fix edje_part_helpers refcounting
Summary:
the reference from efl_reuse was forgotten & the parent relation was not
correctlty setted, which led to the fact that NOREF was never emitted.
This caused that thte object never really was destructed probebly, and
thus the del_interceptor_cb was not executed, and the object simply
leaked.
The test checks that those properties are correctly set, additionally a
error is printed in the efl code when a part has not the expected
reference properties. This also enforces errors when users are doing
wrong things with objects returned by efl_part.
Reviewers: ManMower, zmike
Reviewed By: zmike
Subscribers: cedric, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6254
Diffstat (limited to '')
-rw-r--r-- | src/lib/efl/interfaces/efl_interfaces_main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index d9b10e89d2..f5b8634d68 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c | |||
@@ -96,6 +96,12 @@ efl_part(const Eo *obj, const char *name) | |||
96 | if (!r) return NULL; | 96 | if (!r) return NULL; |
97 | 97 | ||
98 | efl_event_callback_add(r, EFL_EVENT_NOREF, _noref_death, NULL); | 98 | efl_event_callback_add(r, EFL_EVENT_NOREF, _noref_death, NULL); |
99 | |||
100 | //ensure that the parts that we have here are never leaked | ||
101 | //by checking theire references and ownership details | ||
102 | EINA_SAFETY_ON_NULL_RETURN_VAL(efl_parent_get(r), r); | ||
103 | EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_ref_count(r) == 1, r); | ||
104 | |||
99 | ___efl_auto_unref_set(r, EINA_TRUE); | 105 | ___efl_auto_unref_set(r, EINA_TRUE); |
100 | 106 | ||
101 | return efl_ref(r); | 107 | return efl_ref(r); |