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

Issue 2041213002: Address a crash under -[NSWindow close] via a WeakPtr PostTask from Browser::TabStripEmpty() (Closed)

Created:
4 years, 6 months ago by tapted
Modified:
4 years, 6 months ago
Reviewers:
Robert Sesek
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Address a crash under -[NSWindow close] via a WeakPtr PostTask from Browser::TabStripEmpty() This is the #1 browser crash for Mac in current Beta - 52.0.2743.24. The stacks all have in common a Posted Task that's triggering -[NSWindow close] via a base::WeakPtr<Browser>. This only happens via Browser::TabStripEmpty(). The WeakPtr is only nerfed when BrowserWindowController's dealloc fully completes. It seems plausible that this can be after the NSWindow's dealloc fully completes, leading to an invalid access. One would hope that [NSWindowController window] returns nil once the controlled window is destroyed, but this seems to not be guaranteed. To (speculatively) fix, set a flag when the controlled window invokes -[NSWindowController windowWillClose]. The window shouldn't be accessed after this. Ensure the C++ BrowserWindowCocoa shim returns nil in this case for the window, even if -[NSWindowController window] doesn't. BUG=616701 Committed: https://crrev.com/7e91932ca0df94f1d3ebe9303e6ff31637751c17 Cr-Commit-Position: refs/heads/master@{#398474}

Patch Set 1 #

Patch Set 2 : nit comment #

Total comments: 4

Patch Set 3 : setWindow:nil #

Patch Set 4 : add a retain #

Patch Set 5 : Back to patchset 2 #

Total comments: 2

Patch Set 6 : windowWillClose #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -8 lines) Patch
M chrome/browser/ui/cocoa/browser_window_cocoa.h View 1 2 3 4 5 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_cocoa.mm View 1 3 4 4 chunks +18 lines, -8 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller.mm View 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 28 (12 generated)
tapted
Hi Robert, please take a look. (and please CQ if it looks good - I ...
4 years, 6 months ago (2016-06-07 00:24:37 UTC) #3
Robert Sesek
https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm File chrome/browser/ui/cocoa/browser_window_controller.mm (right): https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm#newcode546 chrome/browser/ui/cocoa/browser_window_controller.mm:546: } What about: [[self window] performSelector:@selector(autorelease) withObject:nil afterDelay:0]; [self ...
4 years, 6 months ago (2016-06-07 16:43:36 UTC) #4
tapted
https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm File chrome/browser/ui/cocoa/browser_window_controller.mm (right): https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm#newcode546 chrome/browser/ui/cocoa/browser_window_controller.mm:546: } On 2016/06/07 16:43:35, Robert Sesek wrote: > What ...
4 years, 6 months ago (2016-06-08 00:00:29 UTC) #5
tapted
https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm File chrome/browser/ui/cocoa/browser_window_controller.mm (right): https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm#newcode546 chrome/browser/ui/cocoa/browser_window_controller.mm:546: } On 2016/06/08 00:00:29, tapted wrote: > On 2016/06/07 ...
4 years, 6 months ago (2016-06-08 00:07:43 UTC) #6
Robert Sesek
https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm File chrome/browser/ui/cocoa/browser_window_controller.mm (right): https://codereview.chromium.org/2041213002/diff/20001/chrome/browser/ui/cocoa/browser_window_controller.mm#newcode546 chrome/browser/ui/cocoa/browser_window_controller.mm:546: } On 2016/06/08 00:00:29, tapted wrote: > On 2016/06/07 ...
4 years, 6 months ago (2016-06-08 00:09:00 UTC) #7
Robert Sesek
race condition LGTM
4 years, 6 months ago (2016-06-08 00:10:08 UTC) #8
tapted
On 2016/06/08 00:10:08, Robert Sesek wrote: > race condition LGTM Lots of crashes in browser_tests ...
4 years, 6 months ago (2016-06-08 01:09:31 UTC) #11
tapted
PTAL - went back to patchset 2... It's the best I can come up with ...
4 years, 6 months ago (2016-06-08 01:22:30 UTC) #13
Robert Sesek
I'm not totally convinced this will fix the issue, but let's go with it as ...
4 years, 6 months ago (2016-06-08 02:00:32 UTC) #14
tapted
On 2016/06/08 02:00:32, Robert Sesek wrote: > I'm not totally convinced this will fix the ...
4 years, 6 months ago (2016-06-08 02:47:27 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2041213002/100001
4 years, 6 months ago (2016-06-08 03:01:34 UTC) #20
tapted
On 2016/06/08 02:47:27, tapted wrote: > On 2016/06/08 02:00:32, Robert Sesek wrote: > > I'm ...
4 years, 6 months ago (2016-06-08 03:21:38 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2041213002/100001
4 years, 6 months ago (2016-06-08 03:22:22 UTC) #23
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 6 months ago (2016-06-08 03:55:08 UTC) #25
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/7e91932ca0df94f1d3ebe9303e6ff31637751c17 Cr-Commit-Position: refs/heads/master@{#398474}
4 years, 6 months ago (2016-06-08 03:57:05 UTC) #27
tapted
4 years, 6 months ago (2016-06-09 05:58:57 UTC) #28
Message was sent while issue was closed.
A revert of this CL (patchset #6 id:100001) has been created in
https://codereview.chromium.org/2042123005/ by tapted@chromium.org.

The reason for reverting is: Fix didn't work..

Powered by Google App Engine
This is Rietveld 408576698