Prevent duplicated call of |Terminate| 84/110584/6
authorYoungsoo Choi <kenshin.choi@samsung.com>
Mon, 16 Jan 2017 03:51:12 +0000 (12:51 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Wed, 18 Jan 2017 04:52:41 +0000 (13:52 +0900)
There will be duplicated call of |Terminate| in following case.
When pressing back key multiple times,
h/w key events emit multiple |Terminate| as they are pressed.
The |Terminate| needs to be processed once.

Bug: http://suprem.sec.samsung.net/jira/browse/TWF-2801

Change-Id: I16745993d60df78c04e354352066a7db7181e303
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
runtime/browser/web_application.cc
runtime/browser/web_application.h

index 97d9bb3..dd6383e 100755 (executable)
@@ -294,6 +294,7 @@ WebApplication::WebApplication(
       verbose_mode_(false),
       lang_changed_mode_(false),
       is_terminate_called_(false),
+      is_close_page_called_(false),
       ewk_context_(
           ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH)),
       has_ownership_of_ewk_context_(true),
@@ -313,6 +314,7 @@ WebApplication::WebApplication(
       debug_mode_(false),
       verbose_mode_(false),
       is_terminate_called_(false),
+      is_close_page_called_(false),
       ewk_context_(context),
       has_ownership_of_ewk_context_(false),
       window_(window),
@@ -647,6 +649,10 @@ void WebApplication::Suspend() {
 }
 
 void WebApplication::Terminate() {
+  // Just process closing page once.
+  if (is_terminate_called_ || is_close_page_called_)
+    return;
+
   is_terminate_called_ = true;
   ClosePage();
 }
@@ -676,6 +682,7 @@ void WebApplication::ProcessClosingPage() {
 
 void WebApplication::ClosePage() {
   LOGGER(DEBUG);
+  is_close_page_called_ = true;
 
   int valid_evas_object_count = 0;
   auto it = view_stack_.begin();
index 446fb49..f35fd04 100755 (executable)
@@ -141,6 +141,7 @@ class WebApplication : public WebView::EventListener {
   bool verbose_mode_;
   bool lang_changed_mode_;
   bool is_terminate_called_;
+  bool is_close_page_called_;
   Ewk_Context* ewk_context_;
   bool has_ownership_of_ewk_context_;
   NativeWindow* window_;