Page MenuHomePhabricator

evas_object_grid: Fix memory leak.

Authored by CHAN on Jan 21 2020, 2:28 AM.



_evas_object_smart_clipped_init() (in evas_object_smart.c) is called when evas_object_grid is created.
And a rectangle is created in the function.

But, the rectangle is not deleted even though evas_objecct_grid is deleted.
This patch fixes the problem by deleting it in smart_del fucntion.

Test Plan

Check this sample app.

Diff Detail

rEFL core/efl
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
CHAN created this revision.Jan 21 2020, 2:28 AM

It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added:

CHAN requested review of this revision.Jan 21 2020, 2:28 AM
CHAN edited the summary of this revision. (Show Details)Jan 21 2020, 2:29 AM
CHAN added reviewers: cedric, Hermet.
CHAN edited the test plan for this revision. (Show Details)
woohyun edited the summary of this revision. (Show Details)Jan 21 2020, 8:14 PM
woohyun added a reviewer: bu5hm4n.

This looks conceptionally correct. However, the example that uses EVAS_SMART_SUBCLASS_NEW does not call efl_canvas_group_del but rather _evas_smart_example_parent_sc->del(o); I do not really know if this is the same. (cc @raster @cedric).

Additionally, a few lines before, priv->children is leaked with freed memory, could you fix that ? (Best case by not using l at all, but rather priv->children directly) ?

I think for long term, using legacy API in legacy object should be preferred.

bu5hm4n requested changes to this revision.Jan 29 2020, 12:46 AM

Ping? After checking it out, you need to call ->del(o) not efl_canvas_group_del ... :) And I agree with @cedric.

This revision now requires changes to proceed.Jan 29 2020, 12:46 AM
CHAN updated this revision to Diff 28703.Jan 29 2020, 10:25 PM

Using legacy API.

bu5hm4n accepted this revision.Jan 31 2020, 4:46 AM

Thank you :)

This revision is now accepted and ready to land.Jan 31 2020, 4:46 AM
Closed by commit rEFL260964dbdd82: evas_object_grid: Fix memory leak. (authored by Woochanlee <>, committed by Marcel Hollerbach <>). · Explain WhyJan 31 2020, 4:53 AM
This revision was automatically updated to reflect the committed changes.