Page MenuHomePhabricator

elementary: fix initialization order and memory leak when setting model on Efl.Ui.CollectionView.
ClosedPublic

Authored by cedric on Thu, Nov 7, 4:23 PM.

Details

Summary

This patch use volatile model to make sure that a model is properly cleaned once it is not
used anymore.

Depends on D10624

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.
cedric created this revision.Thu, Nov 7, 4:23 PM
cedric requested review of this revision.Thu, Nov 7, 4:23 PM
cedric updated this revision to Diff 26770.Fri, Nov 8, 12:16 PM
cedric edited the summary of this revision. (Show Details)

rebase

bu5hm4n added inline comments.Sun, Nov 10, 4:25 AM
src/lib/elementary/efl_ui_collection_view.c
1959

This seems a bit useless, you could just create model with efl_add without the additional ref, this is giving up on the reverence later on anyways.

cedric added inline comments.Sun, Nov 10, 12:30 PM
src/lib/elementary/efl_ui_collection_view.c
1959

That's because of volatile make. It will trigger every time the refcount goes to zero. So until it is given a reference to someone, any action before explicitly taking a reference might lead to the object being destroyed. Taking explicit reference solve this problem.

bu5hm4n accepted this revision.Wed, Nov 13, 12:04 PM
bu5hm4n added inline comments.
src/lib/elementary/efl_ui_collection_view.c
1959

I ... eh ... well ... hm ... ok ... i believe you.

This revision is now accepted and ready to land.Wed, Nov 13, 12:04 PM
Closed by commit rEFL6cec0df499f1: elementary: fix initialization order and memory leak when setting model on Efl. (authored by cedric, committed by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyWed, Nov 13, 12:17 PM
This revision was automatically updated to reflect the committed changes.