Page MenuHomePhabricator

efl_ui_text: remove duplicated empty string initialization
ClosedPublic

Authored by YOhoho on Jan 8 2019, 8:08 AM.

Details

Summary

string of text_obj is already initialized in evas_object_textblock_init.
also, this patch fixes text_set bug.

Test Plan
efl_add(EFL_UI_TEXT_CLASS, parent,
        efl_text_set(efl_added, "string"));

or

elementary_test -to 'efl.ui.slider'

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.
YOhoho created this revision.Jan 8 2019, 8:08 AM
YOhoho requested review of this revision.Jan 8 2019, 8:08 AM

I would like to review this but I do not understand what problem it is solving, besides a double initialization.
Is there a console output I should look at?

zmike added a subscriber: zmike.Jan 8 2019, 9:44 AM

@segfaultxavi he's referring to evas_object_textblock.c:13539 where textblock sets "" during object creation, making this call redundant and also harmful in the case where a string is passed during the constructor as in the example provided.

zmike accepted this revision.Jan 8 2019, 9:44 AM
This revision is now accepted and ready to land.Jan 8 2019, 9:44 AM
YOhoho added a comment.Jan 8 2019, 3:05 PM

@segfaultxavi
You can check a text in elementary_test -to 'efl.ui.slider'with this patch.

OK, I run the efl.ui.slider elementary_test with and without the patch and NOW I understand the problem: There was missing text.

Besides the technical description of the problem (the string was being overridden) , it is always helpful to start with one line giving a high-level description (there was missing text).
This patch is simple enough and perfectly-OK, I'm just saying this to simplify future reviews :)

This revision was automatically updated to reflect the committed changes.