Fix crash in |SelectionControllerEfl::ClearSelectionViaEWebView|.
authorSangHyup Lee <sh53.lee@samsung.com>
Tue, 26 Jan 2016 07:04:47 +0000 (16:04 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 07:55:23 +0000 (07:55 +0000)
If webview evas object deleted by application, destructor of RWHVEfl will be
called. And when RWHVEfl deleted, destructor of SelectionControllerEfl also
will be called because RWHVEfl has a scoped_ptr<SelectionControllerEfl>.

SelectionController try to clear all selection by call |ClearSelectionViaEWebView|
in the destructor. In this case, we should check RWHV and WebContents because
these can be deleted already.

Original beta/m47 patch: http://165.213.202.130/gerrit/#/c/105349

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

Reviewed by: a1.gomes, sns.park

Change-Id: I4f0cb35b2d68a62408be81c4300e93741f3eae6c
Signed-off-by: SangHyup Lee <sh53.lee@samsung.com>
tizen_src/chromium_impl/content/browser/selection/selection_controller_efl.cc

index 5da0637..07ece28 100644 (file)
@@ -196,14 +196,15 @@ void SelectionControllerEfl::UpdateSelectionData(const base::string16& text) {
 }
 
 bool SelectionControllerEfl::ClearSelectionViaEWebView() {
-  if (GetSelectionStatus()) {
-    RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(
-        web_contents_.GetRenderViewHost()->GetWidget());
-    rwhi->ExecuteEditCommand("Unselect", "");
-    return true;
+  if (!GetSelectionStatus() || !web_contents_.GetRenderViewHost() ||
+      web_contents_.IsBeingDestroyed()) {
+    return false;
   }
 
-  return false;
+  RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(
+      web_contents_.GetRenderViewHost()->GetWidget());
+  rwhi->ExecuteEditCommand("Unselect", "");
+  return true;
 }
 
 void SelectionControllerEfl::SetSelectionMode(enum SelectionMode mode) {