From 34e66b24fa3d5d68aa974512b8346d1bb35d3da0 Mon Sep 17 00:00:00 2001 From: Youngcheol Kang Date: Tue, 13 Dec 2016 16:17:33 +0900 Subject: [PATCH] Code refactoring about checking the EventListener of WebView class This patch refactors the codes which related to checking the EventListener of WebView class in WebViewImpl class. It can prevent the crash issue which happens when EventListener was destroyed. Bug: http://suprem.sec.samsung.net/jira/browse/TWF-2633 Change-Id: Id8ad4823594bd18267c51fbe8ab2279f81e77b4b Signed-off-by: Youngcheol Kang --- runtime/browser/web_view_impl.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/runtime/browser/web_view_impl.cc b/runtime/browser/web_view_impl.cc index 6ad4c2ae5..f964232fb 100644 --- a/runtime/browser/web_view_impl.cc +++ b/runtime/browser/web_view_impl.cc @@ -885,26 +885,28 @@ void WebViewImpl::InitEditorClientImeCallback() { Evas_Object*, void* event_info) { WebViewImpl* self = static_cast(user_data); + if (!self->listener_) + return; SoftKeyboardChangeEventValue softkeyboard_value; softkeyboard_value.state = "on"; softkeyboard_value.width = self->ime_width_; softkeyboard_value.height = self->ime_height_; - if (self->listener_) - self->listener_->OnSoftKeyboardChangeEvent(self->view_, softkeyboard_value); + self->listener_->OnSoftKeyboardChangeEvent(self->view_, softkeyboard_value); }; auto ime_closed_callback = [](void* user_data, Evas_Object*, void* event_info) { WebViewImpl* self = static_cast(user_data); + if (!self->listener_) + return; SoftKeyboardChangeEventValue softkeyboard_value; softkeyboard_value.state = "off"; - if (self->listener_) - self->listener_->OnSoftKeyboardChangeEvent(self->view_, softkeyboard_value); + self->listener_->OnSoftKeyboardChangeEvent(self->view_, softkeyboard_value); }; evas_object_smart_callback_add(ewk_view_, "inputmethod,changed", @@ -929,6 +931,9 @@ void WebViewImpl::InitRotaryEventCallback() { Evas_Object*, Eext_Rotary_Event_Info* event_info) -> Eina_Bool { WebViewImpl* self = static_cast(user_data); + if (!self->listener_) + return; + Eext_Rotary_Event_Info* rotary = event_info; RotaryEventType type; -- 2.34.1