Occasional null deref in WebImmediateActionController
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 May 2015 23:08:01 +0000 (23:08 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 May 2015 23:08:01 +0000 (23:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144772
<rdar://problem/20811128>

Reviewed by Beth Dakin.

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _defaultAnimationController]):
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForDataDetectedLink]):
Null-check TextIndicators before dereferencing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183957 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebImmediateActionController.mm

index a3da3af..46d32fd 100644 (file)
@@ -1,3 +1,17 @@
+2015-05-07  Timothy Horton  <timothy_horton@apple.com>
+
+        Occasional null deref in WebImmediateActionController
+        https://bugs.webkit.org/show_bug.cgi?id=144772
+        <rdar://problem/20811128>
+
+        Reviewed by Beth Dakin.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController _defaultAnimationController]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedLink]):
+        Null-check TextIndicators before dereferencing.
+
 2015-05-07  Beth Dakin  <bdakin@apple.com>
 
         New force-related DOM events should fire in WK1 views
index 31aa4bc..2785280 100644 (file)
@@ -260,7 +260,8 @@ using namespace WebCore;
 
             RefPtr<Range> linkRange = rangeOfContents(*_hitTestResult.URLElement());
             RefPtr<TextIndicator> indicator = TextIndicator::createWithRange(*linkRange, TextIndicatorPresentationTransition::FadeIn);
-            [_webView _setTextIndicator:*indicator withLifetime:TextIndicatorLifetime::Permanent];
+            if (indicator)
+                [_webView _setTextIndicator:*indicator withLifetime:TextIndicatorLifetime::Permanent];
 
             QLPreviewMenuItem *item = [NSMenuItem standardQuickLookMenuItem];
             item.previewStyle = QLPreviewStylePopover;
@@ -419,7 +420,8 @@ static IntRect elementBoundingBoxInWindowCoordinatesFromNode(Node* node)
 
     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
     } interactionChangedHandler:^() {
-        [_webView _setTextIndicator:*detectedDataTextIndicator withLifetime:TextIndicatorLifetime::Permanent];
+        if (detectedDataTextIndicator)
+            [_webView _setTextIndicator:*detectedDataTextIndicator withLifetime:TextIndicatorLifetime::Permanent];
     } interactionStoppedHandler:^() {
         [_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];
     }];
@@ -450,7 +452,8 @@ static IntRect elementBoundingBoxInWindowCoordinatesFromNode(Node* node)
 
     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
     } interactionChangedHandler:^() {
-        [_webView _setTextIndicator:*indicator withLifetime:TextIndicatorLifetime::Permanent];
+        if (indicator)
+            [_webView _setTextIndicator:*indicator withLifetime:TextIndicatorLifetime::Permanent];
     } interactionStoppedHandler:^() {
         [_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];
     }];