Page MenuHomePhabricator

textblock: Fix crash with filters

Authored by jpeg on Nov 27 2018, 2:10 AM.



A crash could happen on a bad call to free() context_dup() returns a
newly malloc'ed context if passed NULL (this seems dubious to me, why
not calloc?).


Test Plan
Add an empty efl.ui.text object
Set markup text as "<gfx_filter='code'>Hello</>"

Diff Detail

rEFL core/efl
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
jpeg created this revision.Nov 27 2018, 2:10 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:

jpeg requested review of this revision.Nov 27 2018, 2:10 AM

Cannot reproduce the problem with this code:

_editor = efl_add(EFL_UI_TEXT_CLASS, box);
efl_text_markup_set(_editor, "<gfx_filter='code'>Hello</>");
efl_pack(box, _editor);

It keeps spewing this line on the console, but no crash:

WRN<60318>: lib/evas/canvas/evas_object_textblock.c:14100 evas_object_textblock_render() Filter 'code' not found on this object
zmike accepted this revision.Jan 9 2019, 9:14 AM
zmike added a subscriber: zmike.

Adding null checks is the accepted practice for solving issues in efl.

This revision is now accepted and ready to land.Jan 9 2019, 9:14 AM
This revision was automatically updated to reflect the committed changes.