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

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2854943003: [ios] Unregister CRWWebController delegates in -close. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_web_controller.mm
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index dcd448a2246721d1fd3562163c9ab713b7476a77..b87fdca8210473345a426bd70ff40bb71fa3feaf 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -1033,14 +1033,6 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
DCHECK([NSThread isMainThread]);
DCHECK(_isBeingDestroyed); // 'close' must have been called already.
DCHECK(!_webView);
- // TODO(crbug.com/662860): Don't set the delegate to nil.
- [_containerView setDelegate:nil];
- if ([self.nativeController respondsToSelector:@selector(setDelegate:)]) {
- [self.nativeController setDelegate:nil];
- }
- _touchTrackingRecognizer.get().touchTrackingDelegate = nil;
- [[_webViewProxy scrollViewProxy] removeObserver:self];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
@@ -1216,6 +1208,16 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
[self removeWebViewAllowingCachedReconstruction:NO];
_webStateImpl = nullptr;
+
+ DCHECK(!_webView);
+ // TODO(crbug.com/662860): Don't set the delegate to nil.
+ [_containerView setDelegate:nil];
+ if ([self.nativeController respondsToSelector:@selector(setDelegate:)]) {
+ [self.nativeController setDelegate:nil];
+ }
+ _touchTrackingRecognizer.get().touchTrackingDelegate = nil;
+ [[_webViewProxy scrollViewProxy] removeObserver:self];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
}
// TODO(shreyasv): This code is shared with SnapshotManager. Remove this and add
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698