diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2018-03-15 20:26:40 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2018-03-26 08:39:54 +0900 |
commit | c807c90ecb33f10f36ef452f47e7b1039ea4c788 (patch) | |
tree | ba510b18585d4a364dde0c2568419989645da8bb | |
parent | d58519426565443dcf38a57b0b979cc6c45dda15 (diff) | |
download | efl-c807c90ecb33f10f36ef452f47e7b1039ea4c788.tar.gz |
ecore_imf: check validation before accessing context class
Change-Id: Id329b87167caa71aadd8ca454c50e9aaca275415
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
-rw-r--r-- | src/lib/ecore_imf/ecore_imf_context.c | 83 |
1 files changed, 45 insertions, 38 deletions
diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index caa2d59f1b..402f194c11 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c @@ -210,7 +210,7 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx) if (show_req_ctx == ctx) show_req_ctx = NULL; - if (ctx->klass->del) ctx->klass->del(ctx); + if (ctx->klass && ctx->klass->del) ctx->klass->del(ctx); if (ctx->callbacks) { @@ -237,7 +237,8 @@ ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window) "ecore_imf_context_client_window_set"); return; } - if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window); + + if (ctx->klass && ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window); ctx->window = window; } @@ -262,7 +263,8 @@ ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) "ecore_imf_context_client_canvas_set"); return; } - if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas); + + if (ctx->klass && ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas); ctx->client_canvas = canvas; } @@ -289,7 +291,7 @@ ecore_imf_context_show(Ecore_IMF_Context *ctx) } show_req_ctx = ctx; - if (ctx->klass->show) ctx->klass->show(ctx); + if (ctx->klass && ctx->klass->show) ctx->klass->show(ctx); } EAPI void @@ -302,7 +304,7 @@ ecore_imf_context_hide(Ecore_IMF_Context *ctx) return; } - if (ctx->klass->hide) ctx->klass->hide(ctx); + if (ctx->klass && ctx->klass->hide) ctx->klass->hide(ctx); } EAPI void @@ -314,7 +316,8 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu "ecore_imf_context_preedit_string_get"); return; } - if (ctx->klass->preedit_string_get) + + if (ctx->klass && ctx->klass->preedit_string_get) ctx->klass->preedit_string_get(ctx, str, cursor_pos); else { @@ -332,7 +335,7 @@ ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, cha "ecore_imf_context_preedit_string_with_attributes_get"); return; } - if (ctx->klass->preedit_string_with_attributes_get) + if (ctx->klass && ctx->klass->preedit_string_with_attributes_get) ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos); else { @@ -351,7 +354,8 @@ ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) "ecore_imf_context_focus_in"); return; } - if (ctx->klass->focus_in) ctx->klass->focus_in(ctx); + + if (ctx->klass && ctx->klass->focus_in) ctx->klass->focus_in(ctx); } EAPI void @@ -363,7 +367,8 @@ ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) "ecore_imf_context_focus_out"); return; } - if (ctx->klass->focus_out) ctx->klass->focus_out(ctx); + + if (ctx->klass && ctx->klass->focus_out) ctx->klass->focus_out(ctx); } EAPI void @@ -375,7 +380,8 @@ ecore_imf_context_reset(Ecore_IMF_Context *ctx) "ecore_imf_context_reset"); return; } - if (ctx->klass->reset) ctx->klass->reset(ctx); + + if (ctx->klass && ctx->klass->reset) ctx->klass->reset(ctx); } EAPI void @@ -387,7 +393,8 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) "ecore_imf_context_cursor_position_set"); return; } - if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos); + + if (ctx->klass && ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos); } EAPI void @@ -399,7 +406,7 @@ ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int "ecore_imf_context_cursor_location_set"); return; } - if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h); + if (ctx->klass && ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h); } EAPI void @@ -411,7 +418,7 @@ ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit) "ecore_imf_context_use_preedit_set"); return; } - if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit); + if (ctx->klass && ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit); } EAPI void @@ -428,7 +435,7 @@ ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool predict { ctx->allow_prediction = prediction; - if (ctx->klass->prediction_allow_set) + if (ctx->klass && ctx->klass->prediction_allow_set) ctx->klass->prediction_allow_set(ctx, prediction); } } @@ -460,7 +467,7 @@ ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocap { ctx->autocapital_type = autocapital_type; - if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type); + if (ctx->klass && ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type); } } @@ -514,7 +521,7 @@ ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode in "ecore_imf_context_input_mode_set"); return; } - if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode); + if (ctx->klass && ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode); ctx->input_mode = input_mode; } @@ -539,7 +546,7 @@ ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type "ecore_imf_context_filter_event"); return EINA_FALSE; } - if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event); + if (ctx->klass && ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event); return EINA_FALSE; } @@ -837,7 +844,7 @@ ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx) return; } - if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx); + if (ctx->klass && ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx); } EAPI void @@ -850,7 +857,7 @@ ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx) return; } - if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx); + if (ctx->klass && ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx); } EAPI void @@ -865,7 +872,7 @@ ecore_imf_context_input_hint_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Hints i if (ctx->input_hints != input_hints) { - if (ctx->klass->input_hint_set) + if (ctx->klass && ctx->klass->input_hint_set) ctx->klass->input_hint_set(ctx, input_hints); ctx->input_hints = input_hints; @@ -899,7 +906,7 @@ ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx) if ((ctx->input_panel_enabled) || (getenv("ECORE_IMF_INPUT_PANEL_ENABLED"))) { - if (ctx->klass->show) ctx->klass->show(ctx); + if (ctx->klass && ctx->klass->show) ctx->klass->show(ctx); } } @@ -916,7 +923,7 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) if ((ctx->input_panel_enabled) || (getenv("ECORE_IMF_INPUT_PANEL_ENABLED"))) { - if (ctx->klass->hide) ctx->klass->hide(ctx); + if (ctx->klass && ctx->klass->hide) ctx->klass->hide(ctx); } } @@ -932,7 +939,7 @@ ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input if (ctx->input_panel_layout != layout) { - if (ctx->klass->input_panel_layout_set) + if (ctx->klass && ctx->klass->input_panel_layout_set) ctx->klass->input_panel_layout_set(ctx, layout); ctx->input_panel_layout = layout; @@ -949,7 +956,7 @@ ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx) return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; } - if (ctx->klass->input_panel_layout_get) + if (ctx->klass && ctx->klass->input_panel_layout_get) return ctx->input_panel_layout; else return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; @@ -993,7 +1000,7 @@ ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Inp if (ctx->input_panel_lang != lang) { - if (ctx->klass->input_panel_language_set) + if (ctx->klass && ctx->klass->input_panel_language_set) ctx->klass->input_panel_language_set(ctx, lang); ctx->input_panel_lang = lang; @@ -1052,7 +1059,7 @@ ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *dat if (!data) return; - if (ctx->klass->input_panel_imdata_set) + if (ctx->klass && ctx->klass->input_panel_imdata_set) ctx->klass->input_panel_imdata_set(ctx, data, len); } @@ -1068,7 +1075,7 @@ ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int if (!data) return; - if (ctx->klass->input_panel_imdata_get) + if (ctx->klass && ctx->klass->input_panel_imdata_get) ctx->klass->input_panel_imdata_get(ctx, data, len); } @@ -1085,7 +1092,7 @@ ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_ if (ctx->input_panel_return_key_type != return_key_type) { ctx->input_panel_return_key_type = return_key_type; - if (ctx->klass->input_panel_return_key_type_set) + if (ctx->klass && ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type); } } @@ -1116,7 +1123,7 @@ ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Ei if (ctx->input_panel_return_key_disabled != disabled) { ctx->input_panel_return_key_disabled = disabled; - if (ctx->klass->input_panel_return_key_disabled_set) + if (ctx->klass && ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled); } } @@ -1146,7 +1153,7 @@ ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bo if (ctx->input_panel_caps_lock_mode != mode) { - if (ctx->klass->input_panel_caps_lock_mode_set) + if (ctx->klass && ctx->klass->input_panel_caps_lock_mode_set) ctx->klass->input_panel_caps_lock_mode_set(ctx, mode); ctx->input_panel_caps_lock_mode = mode; @@ -1176,7 +1183,7 @@ ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int * return; } - if (ctx->klass->input_panel_geometry_get) + if (ctx->klass && ctx->klass->input_panel_geometry_get) ctx->klass->input_panel_geometry_get(ctx, x, y, w, h); } @@ -1191,7 +1198,7 @@ ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx) return ECORE_IMF_INPUT_PANEL_STATE_HIDE; } - if (ctx->klass->input_panel_state_get) + if (ctx->klass && ctx->klass->input_panel_state_get) state = ctx->klass->input_panel_state_get(ctx); return state; @@ -1319,7 +1326,7 @@ ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char * return; } - if (ctx->klass->input_panel_language_locale_get) + if (ctx->klass && ctx->klass->input_panel_language_locale_get) ctx->klass->input_panel_language_locale_get(ctx, lang); else { @@ -1337,7 +1344,7 @@ ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, i return; } - if (ctx->klass->candidate_panel_geometry_get) + if (ctx->klass && ctx->klass->candidate_panel_geometry_get) ctx->klass->candidate_panel_geometry_get(ctx, x, y, w, h); } @@ -1379,7 +1386,7 @@ ecore_imf_context_bidi_direction_set(Ecore_IMF_Context *ctx, Ecore_IMF_BiDi_Dire if (ctx->bidi_direction != direction) { - if (ctx->klass->bidi_direction_set) + if (ctx->klass && ctx->klass->bidi_direction_set) ctx->klass->bidi_direction_set(ctx, direction); ctx->bidi_direction = direction; @@ -1410,7 +1417,7 @@ ecore_imf_context_keyboard_mode_get(Ecore_IMF_Context *ctx) return ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE; } - if (ctx->klass->keyboard_mode_get) + if (ctx->klass && ctx->klass->keyboard_mode_get) mode = ctx->klass->keyboard_mode_get(ctx); return mode; @@ -1426,7 +1433,7 @@ ecore_imf_context_prediction_hint_set(Ecore_IMF_Context *ctx, const char *predic return; } - if (ctx->klass->prediction_hint_set) + if (ctx->klass && ctx->klass->prediction_hint_set) ctx->klass->prediction_hint_set(ctx, prediction_hint); } @@ -1442,6 +1449,6 @@ ecore_imf_context_mime_type_accept_set(Ecore_IMF_Context *ctx, const char *mime_ if (!mime_type) return; - if (ctx->klass->mime_type_accept_set) + if (ctx->klass && ctx->klass->mime_type_accept_set) ctx->klass->mime_type_accept_set(ctx, mime_type); } |