Page MenuHomePhabricator

efl_ui_focus_layer: avoid a call to NULL
ClosedPublic

Authored by YOhoho on Jan 23 2018, 11:24 PM.

Details

Summary

efl_ui_focus_layer_enable_set(obj, EINA_FALSE) can be called before
registered_manager assigned

Test Plan
  1. EINA_LOG_LEVELS=eo:2 elementary_test -to menu
  2. terminate the elemetary_test
  3. check that there is no focus_manager warning about a call to NULL

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 23 2018, 11:24 PM
YOhoho requested review of this revision.Jan 23 2018, 11:24 PM
jpeg accepted this revision.Jan 24 2018, 1:49 AM
This revision is now accepted and ready to land.Jan 24 2018, 1:49 AM
Closed by commit rEFL8eda161f67f1: efl_ui_focus_layer: avoid a call to NULL (authored by YOhoho, committed by Jean-Philippe Andre <jp.andre@samsung.com>). · Explain WhyJan 24 2018, 1:57 AM
This revision was automatically updated to reflect the committed changes.

This is now merged, however:

I like to style the functions in a way that you only have one return at the end, or a few for parameter checking in the beginning

I like to keep it that way since this lowers the risk of someone adding code to the end of the function, and later recognizing that this code is never executed, since one tiny codepath calls return ...

Please take this to note for further patches, thx! :)

jpeg added a comment.EditedJan 24 2018, 6:26 PM

Yeah I thought about commenting "why not else if (manager) instead?"... :)

YOhoho added a comment.EditedJan 25 2018, 11:27 PM

agree. i think else if (manager) is better :)

btw, when v is true, we don't need to check whether registered_manager already assigned?