Page MenuHomePhabricator

eo: unref compensate is not requires here
ClosedPublic

Authored by bu5hm4n on Jun 6 2018, 8:53 AM.

Details

Summary

this check caused a leaked reference.

Eo objects are having two reference counters a internal and external
one. The external one can be manipulated via efl_ref / efl_unref. The
internal one can be manipulated via _efl_ref _efl_unref.

The external reference counter is keeping a internal reference by the
time the external counter is > 0. When the external counter reaches ==
0 this internal reference is given up with the _efl_unref call in
eo.c:1928.

However, checking unref_compensate in the block in line 1950 leads that
to the leak that this internal reference is not given up at the pointer
user_refcount reaches exactly 0. This check also does not prevent
anything, the object is kept alive anywayys as the efl_unref method
keeps its private internal reference.

This lead to leaks in efl_device_* classes, parts have not been
destructed correctly.
Depends on D6246

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bu5hm4n created this revision.Jun 6 2018, 8:53 AM
zmike accepted this revision.Jun 6 2018, 9:40 AM

Seems good, can you add a test for this too?

This revision is now accepted and ready to land.Jun 6 2018, 9:40 AM

Test case for this is in D6253 :)

Closed by commit rEFL7e72a9328365: eo: unref compensate is not requires here (authored by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyJun 7 2018, 12:39 AM
This revision was automatically updated to reflect the committed changes.