Page MenuHomePhabricator

efl.text: add null check for cursor and attribute internal methods
ClosedPublic

Authored by ali.alzyod on Dec 17 2019, 10:09 AM.

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.
ali.alzyod created this revision.Dec 17 2019, 10:09 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: https://phab.enlightenment.org/w/maintainers_reviewers/

ali.alzyod requested review of this revision.Dec 17 2019, 10:09 AM
ProhtMeyhet added inline comments.
src/lib/evas/canvas/efl_text_cursor.c
435

can the callers of efl_text_cursor_handle_get handle this NULL pointer? This seems like a break of the api, whereas before you would be assured to get a valid pointer from this function. DID

ali.alzyod marked an inline comment as done.Dec 17 2019, 8:37 PM
ali.alzyod added inline comments.
src/lib/evas/canvas/efl_text_cursor.c
435

Yes they handle NULL without problem

ProhtMeyhet added inline comments.Dec 17 2019, 10:04 PM
src/lib/evas/canvas/efl_text_cursor.c
435

Ok then. I'm just asking questions, don't want to annoy you. It's up to the reviewers then :-)

ali.alzyod marked an inline comment as done.Dec 17 2019, 10:35 PM
ali.alzyod added inline comments.
src/lib/evas/canvas/efl_text_cursor.c
435

I am not annoyed at all, your comments are highly appreciated.
I want to add also, this method in internal api that can be called directly by other libs like elementary or edje, so this protection will make it work as normal (public) api function

bu5hm4n requested changes to this revision.Dec 18 2019, 12:22 AM
bu5hm4n added inline comments.
src/lib/evas/canvas/efl_text_cursor.c
435

@ProhtMeyhet before it just would have crashed, I also prefer to just return NULL.

@ali.alzyod can you use efl_data_scope_safe_get instead of efl_data_scope_get, and make this a EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL); Silent NULL returns have caused issues before ... :(

This revision now requires changes to proceed.Dec 18 2019, 12:22 AM
  • update to use eina_check
  • update to use eina_check
ali.alzyod marked 4 inline comments as done.Dec 19 2019, 10:38 PM
bu5hm4n accepted this revision.Jan 2 2020, 3:49 AM

Thank you

This revision is now accepted and ready to land.Jan 2 2020, 3:49 AM
Closed by commit rEFL87e5907f18de: efl.text: add null check for cursor and attribute internal methods (authored by ali.alzyod, committed by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyJan 2 2020, 3:54 AM
This revision was automatically updated to reflect the committed changes.