Page MenuHomePhabricator

efl_ui_table: hardening of pack_at function
ClosedPublic

Authored by bu5hm4n on Apr 4 2019, 5:27 AM.

Details

Summary

_pack_at is used to add new subobjects to the table. When a object is
already part of this table, then we should not add it again. Additional,
when there is already a gi structure, but the parent is something else,
then we should NOT just reuse this struct, otherwise we might use a
struct reference that we do not own. The struct could be owned by
another table widget.

The test must be adjusted, before we did not error on adding a widget
twice. Now we do (just like in box). Hence we should not do that in
test.
Depends on D8518

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.Apr 4 2019, 5:27 AM
YOhoho requested changes to this revision.Apr 15 2019, 10:06 PM

You can adjust col, row, colspan and rowspan using pack_table api, therefore you don't need to adjust test case.
And, efl_canvas_object_render_parent_get is better for checking an existing child (like in box)

src/lib/elementary/efl_ui_table.c
333

I guess this code block need to change the col, row, colspan, rowspan properties of an existing sub-objects.
You should not remove it.

This revision now requires changes to proceed.Apr 15 2019, 10:06 PM

We disallow this on box, for the same efl.pack API, I would either disallow it on both (which is ensures by this revision) or allow it explicitly, and document it.

I would also say that adding it multiple times feels a bit strange, for example pack_at followed by a pack, does it unpack first, then pack again ? (The max col max row numbers would change). I would also claim, that unpacking the widget again from the table to add it again does not add too much overhead, paired with the fact that this seems a rare case (at least to me)

YOhoho accepted this revision.Apr 15 2019, 11:17 PM

Oh, i agree with you in terms of consistency.
Note that, that behavior is different with evas_table, elm_table.

This revision is now accepted and ready to land.Apr 15 2019, 11:17 PM
Closed by commit rEFL48778f3cfb5e: efl_ui_table: hardening of pack_at function (authored by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyApr 17 2019, 6:22 AM
This revision was automatically updated to reflect the committed changes.