Fix crash when calling ewk_shutdown
authorTomasz Czekala <t.czekala@samsung.com>
Tue, 8 Dec 2015 11:34:32 +0000 (12:34 +0100)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
Crashes were failing CHECKs, which expected the client to release all
evas WebView objects before calling ewk_shutdown. Client should fix that,
but Chromium shouldn't crash because of client's bug, so checks were
replaced with information in log.

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=14628

Reviewed by: g.czajkowski, msu.koo

Change-Id: I23b09de78f2536608621a1de07b7de8c956c1ab3
Signed-off-by: Tomasz Czekala <t.czekala@samsung.com>
tizen_src/ewk/efl_integration/browser/autofill/personal_data_manager_factory.cc
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/private/ewk_context_private.cc
tizen_src/ewk/efl_integration/public/ewk_main.h

index fa32962..3de75ff 100644 (file)
@@ -59,7 +59,9 @@ PersonalDataManagerFactory::PersonalDataManagerFactory()
 }
 
 PersonalDataManagerFactory::~PersonalDataManagerFactory() {
-  CHECK(personal_data_manager_id_map_.IsEmpty());
+  if (!personal_data_manager_id_map_.IsEmpty())
+    LOG(ERROR) << "Client didn't destroy all WebView objects"
+        << " before calling ewk_shutdown";
 }
 
 void PersonalDataManagerFactory::SetCallback(
index cc55ac2..18e654d 100644 (file)
@@ -381,6 +381,9 @@ EWebView::~EWebView()
 
   GetPermissionPopupManager()->DeleteAllPermissionRequest();
   permission_popup_manager_.reset();
+
+  if (context_->GetImpl()->browser_context()->IsOffTheRecord())
+    Ewk_Context::Delete(context_.get());
 }
 
 void EWebView::ReleasePopupMenuList() {
index 1320bd6..01d7518 100644 (file)
@@ -43,9 +43,10 @@ void Ewk_Context::DefaultContextRelease() {
     // be called only when all webviews are closed. This won't check if all
     // webviews are destroyed but we will be sure that all webviews using
     // default web context are destroyed.
-    CHECK(default_context_->HasOneRef());
+    if (!default_context_->HasOneRef())
+      LOG(ERROR) << "Client didn't destroy all WebView objects"
+          << " before calling ewk_shutdown";
     default_context_->Release();
-    CHECK(default_context_ == NULL);
   }
 }
 
index 6554d8d..1982e48 100644 (file)
@@ -50,6 +50,8 @@ EXPORT_API int ewk_init(void);
  *
  * If the reference count reaches 0 WebKit's instance is destroyed.
  *
+ * Before calling ewk_shutdown client should delete all WebView objects it received from the engine.
+ *
  * @return a reference count of WebKit's instance
  */
 EXPORT_API int ewk_shutdown(void);