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

Issue 2445343005: Work around a macOS 10.12 bug involving objects with weak delegates (Closed)

Created:
4 years, 1 month ago by Mark Mentovai
Modified:
4 years, 1 month ago
Reviewers:
Avi (use Gerrit)
CC:
chromium-reviews, mac-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Work around a macOS 10.12 bug involving objects with weak delegates NSNetService and NSNetServiceBrowser each have non-owned delegates. In 10.12, Apple appears to have updated them to maintain their delegate references as zeroing weak pointers. Unfortunately, they seem to have done this by hand instead of using the compiler's support for it, and they left something out. When objects of either of these classes are deallocated, they fail to unregister their weak interest in their delegates. When the delegates subsequently are deallocated, they will attempt to clear the pointers to themselves in objects that no longer exist. This manifests itself in messages like: Google Chrome[29616]: objc[29616]: __weak variable at 0x600002654890 holds 0x2121212121212121 instead of 0x60000263f8e0. This is probably incorrect use of objc_storeWeak() and objc_loadWeak(). Break on objc_weak_error to debug. This bug has been filed with Apple as http://openradar.appspot.com/28943305. As a workaround, set these objects' delegates to nil when destroying them. This removes their weak interest in their delegates. BUG=657495 Committed: https://crrev.com/97de983007388a7a537ad8c1e5fbbd1bb20f4305 Cr-Commit-Position: refs/heads/master@{#427736}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+14 lines, -0 lines) Patch
M chrome/browser/local_discovery/service_discovery_client_mac.mm View 2 chunks +14 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (9 generated)
Mark Mentovai
4 years, 1 month ago (2016-10-26 16:11:39 UTC) #4
Avi (use Gerrit)
lgtm
4 years, 1 month ago (2016-10-26 16:16:53 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2445343005/1
4 years, 1 month ago (2016-10-26 17:29:25 UTC) #10
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 1 month ago (2016-10-26 17:39:33 UTC) #12
commit-bot: I haz the power
4 years, 1 month ago (2016-10-26 17:51:06 UTC) #14
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/97de983007388a7a537ad8c1e5fbbd1bb20f4305
Cr-Commit-Position: refs/heads/master@{#427736}

Powered by Google App Engine
This is Rietveld 408576698