Prevent duplicated eventcallback call 62/109262/2 submit/tizen_3.0.m2/20170109.135709 submit/tizen_3.0/20170109.135200
authorws29.jung <ws29.jung@samsung.com>
Mon, 9 Jan 2017 12:23:32 +0000 (21:23 +0900)
committerws29.jung <ws29.jung@samsung.com>
Mon, 9 Jan 2017 13:47:12 +0000 (22:47 +0900)
Unexpectly, there is some case which calls same function twice.
To prevent these case, it is proper to set eventlistener to NULL
when webview is pop/erased from view stack.

Bug: http://suprem.sec.samsung.net/jira/browse/TSAM-12508

Change-Id: Ie1931bc9d20e3db0c3dde04f640b82e8b3fa17dc
Signed-off-by: ws29.jung <ws29.jung@samsung.com>
runtime/browser/web_application.cc

index 31613dd..9a5d50b 100755 (executable)
@@ -675,19 +675,23 @@ void WebApplication::RemoveWebViewFromStack(WebView* view) {
 
   WebView* current = view_stack_.front();
   if (current == view) {
+    // In order to prevent the crash issue due to the callback
+    // which occur after destroying WebApplication class,
+    // we have to set the 'SetEventListener' to NULL.
+    view->SetEventListener(NULL);
     view_stack_.pop_front();
   } else {
     auto found = std::find(view_stack_.begin(), view_stack_.end(), view);
     if (found != view_stack_.end()) {
+      // In order to prevent the crash issue due to the callback
+      // which occur after destroying WebApplication class,
+      // we have to set the 'SetEventListener' to NULL.
+      view->SetEventListener(NULL);
       view_stack_.erase(found);
     }
   }
 
   if (view_stack_.size() == 0) {
-    // In order to prevent the crash issue due to the callback
-    // which occur after destroying WebApplication class,
-    // we have to set the 'SetEventListener' to NULL.
-    view->SetEventListener(NULL);
     Terminate();
   } else if (current != view_stack_.front()) {
     view_stack_.front()->SetVisibility(true);