Commit d1575a04 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Removes NS_RETURNS_RETAINED from NewFeedViewController

It seems that the NS_RETURNS_RETAINED annotation is causing a zombie crash
when dealoc-ing the VC. The crash started to happen after http://cl/339487970/depot/google3/googlemac/iPhone/Shared/Discover/Library/UI/Protocols/DSCActionProducer.h
Which fixed a retention cycle inside Discover

In order to fix this crash the annotation is removed and the provider
will own the ViewController (as it should be the case since we don't
have the NS_RETURNS_RETAINED annotation anymore, which means the caller
shouldn't be in charge of owning the object)

Downstream CL:3381210

Bug: 1145136, 1145136, 1145153
Change-Id: I3dbd0f576ab9c290c8d636a0a086876ff9ba340a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518937
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824420}
parent 92e08f20
......@@ -332,6 +332,11 @@
[self.sharingCoordinator stop];
self.sharingCoordinator = nil;
self.headerController = nil;
if (IsDiscoverFeedEnabled()) {
ios::GetChromeBrowserProvider()
->GetDiscoverFeedProvider()
->RemoveFeedViewController(self.discoverFeedViewController);
}
_visible = NO;
}
......
......@@ -43,8 +43,10 @@ class DiscoverFeedProvider {
// Returns true if the Discover Feed is enabled.
virtual bool IsDiscoverFeedEnabled();
// Returns the Discover Feed ViewController.
virtual UIViewController* NewFeedViewController(Browser* browser)
NS_RETURNS_RETAINED;
virtual UIViewController* NewFeedViewController(Browser* browser);
// Removes the Discover |feedViewController|. It should be called whenever
// |feedViewController| will no longer be used.
virtual void RemoveFeedViewController(UIViewController* feedViewController);
// Updates the feed's theme to match the user's theme (light/dark).
virtual void UpdateTheme();
// Refreshes the Discover Feed. Once the Feed model is refreshed it will
......
......@@ -21,6 +21,9 @@ UIViewController* DiscoverFeedProvider::NewFeedViewController(
return nil;
}
void DiscoverFeedProvider::RemoveFeedViewController(
UIViewController* feedViewController) {}
void DiscoverFeedProvider::UpdateTheme() {}
void DiscoverFeedProvider::RefreshFeed() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment