Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: ios/web_view/internal/cwv_scroll_view.mm

Issue 2847803006: Fix a crash bug on deallocation of CWVWebView caused by CWVScrollView. (Closed)
Patch Set: Rebase. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/web_view/shell/shell_view_controller.m » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web_view/public/cwv_scroll_view.h" 5 #import "ios/web_view/public/cwv_scroll_view.h"
6 6
7 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h" 7 #import "ios/web/public/web_state/ui/crw_web_view_scroll_view_proxy.h"
8 #import "ios/web_view/internal/cwv_scroll_view_internal.h" 8 #import "ios/web_view/internal/cwv_scroll_view_internal.h"
9 #import "ios/web_view/public/cwv_scroll_view_delegate.h" 9 #import "ios/web_view/public/cwv_scroll_view_delegate.h"
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 - (void)setContentInset:(UIEdgeInsets)contentInset { 57 - (void)setContentInset:(UIEdgeInsets)contentInset {
58 _proxy.contentInset = contentInset; 58 _proxy.contentInset = contentInset;
59 } 59 }
60 60
61 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer { 61 - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer {
62 [_proxy addGestureRecognizer:gestureRecognizer]; 62 [_proxy addGestureRecognizer:gestureRecognizer];
63 } 63 }
64 64
65 #pragma mark - NSObject
66
67 - (void)dealloc {
68 // Removes |self| from |_proxy|'s observers. Otherwise |_proxy| will keep a
69 // dangling pointer to |self| and cause SEGV later.
70 [_proxy removeObserver:self];
71 }
72
65 #pragma mark - CRWWebViewScrollViewObserver 73 #pragma mark - CRWWebViewScrollViewObserver
66 74
67 - (void)webViewScrollViewWillBeginDragging: 75 - (void)webViewScrollViewWillBeginDragging:
68 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { 76 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy {
69 SEL selector = @selector(webViewScrollViewWillBeginDragging:); 77 SEL selector = @selector(webViewScrollViewWillBeginDragging:);
70 if ([_delegate respondsToSelector:selector]) { 78 if ([_delegate respondsToSelector:selector]) {
71 [_delegate scrollViewWillBeginDragging:self]; 79 [_delegate scrollViewWillBeginDragging:self];
72 } 80 }
73 } 81 }
74 - (void)webViewScrollViewWillEndDragging: 82 - (void)webViewScrollViewWillEndDragging:
(...skipping 24 matching lines...) Expand all
99 [_delegate scrollViewDidEndDecelerating:self]; 107 [_delegate scrollViewDidEndDecelerating:self];
100 } 108 }
101 } 109 }
102 110
103 - (void)webViewScrollViewDidResetContentSize: 111 - (void)webViewScrollViewDidResetContentSize:
104 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy { 112 (CRWWebViewScrollViewProxy*)webViewScrollViewProxy {
105 self.contentSize = _proxy.contentSize; 113 self.contentSize = _proxy.contentSize;
106 } 114 }
107 115
108 @end 116 @end
OLDNEW
« no previous file with comments | « no previous file | ios/web_view/shell/shell_view_controller.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698