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

Unified Diff: chrome/browser/local_discovery/service_discovery_client_mac.mm

Issue 2445343005: Work around a macOS 10.12 bug involving objects with weak delegates (Closed)
Patch Set: Created 4 years, 2 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: chrome/browser/local_discovery/service_discovery_client_mac.mm
diff --git a/chrome/browser/local_discovery/service_discovery_client_mac.mm b/chrome/browser/local_discovery/service_discovery_client_mac.mm
index 6f014fbc2adec82e1a59d3fc869aa9bfbb369a4a..23f77f54537b827b0b9ac2e09889471f9dfae4ea 100644
--- a/chrome/browser/local_discovery/service_discovery_client_mac.mm
+++ b/chrome/browser/local_discovery/service_discovery_client_mac.mm
@@ -186,6 +186,13 @@ void ParseTxtRecord(NSData* record, std::vector<std::string>* output) {
ServiceWatcherImplMac::NetServiceBrowserContainer::
~NetServiceBrowserContainer() {
DCHECK(IsOnServiceDiscoveryThread());
+
+ // Work around a 10.12 bug: NSNetServiceBrowser doesn't lose interest in its
+ // weak delegate during deallocation, so a subsequently-deallocated delegate
+ // attempts to clear the pointer to itself in an NSNetServiceBrowser that's
+ // already gone.
+ // https://crbug.com/657495, https://openradar.appspot.com/28943305
+ [browser_ setDelegate:nil];
}
void ServiceWatcherImplMac::NetServiceBrowserContainer::Start() {
@@ -299,6 +306,13 @@ void ParseTxtRecord(NSData* record, std::vector<std::string>* output) {
ServiceResolverImplMac::NetServiceContainer::~NetServiceContainer() {
DCHECK(IsOnServiceDiscoveryThread());
+
+ // Work around a 10.12 bug: NSNetService doesn't lose interest in its weak
+ // delegate during deallocation, so a subsequently-deallocated delegate
+ // attempts to clear the pointer to itself in an NSNetService that's already
+ // gone.
+ // https://crbug.com/657495, https://openradar.appspot.com/28943305
+ [service_ setDelegate:nil];
}
void ServiceResolverImplMac::NetServiceContainer::StartResolving() {
« 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