New issue
Advanced search Search tips

Issue 604628 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

mac_views_browser: DCHECK failure in NativeViewHostMac::AttachNativeView() during window close

Project Member Reported by tapted@chromium.org, Apr 19 2016

Issue description

Chrome Version       : 52.0.2711.0
OS Version: OS X 10.11.4

What steps will reproduce the problem?

Not sure yet.

The failing check is:

 void NativeViewHostMac::AttachNativeView() {
   DCHECK(host_->native_view());
   DCHECK(!native_view_);
   native_view_.reset([host_->native_view() retain]);

   EnsureNativeViewHasNoChildWidgets(native_view_);
   BridgedNativeWidget* bridge = NativeWidgetMac::GetBridgeForNativeWindow(
       host_->GetWidget()->GetNativeWindow());
>  DCHECK(bridge);
   [bridge->ns_view() addSubview:native_view_];
   bridge->SetAssociationForView(host_, native_view_);
 }

Stack

[21897:1295:0419/170125:FATAL:native_view_host_mac.mm(51)] Check failed: bridge.
4   libviews.dylib                      0x000000012d633692 views::NativeViewHostMac::AttachNativeView() + 914
5   libviews.dylib                      0x000000012d631ede views::NativeViewHost::Attach(NSView*) + 510
6   libwebview.dylib                    0x000000012da42813 views::WebView::AttachWebContents() + 307
7   libwebview.dylib                    0x000000012da41d3b views::WebView::SetWebContents(content::WebContents*) + 1131
8   libchrome_main_dll.dylib            0x000000010a2d0256 BrowserView::OnActiveTabChanged(content::WebContents*, content::WebContents*, int, int) + 902
9   libchrome_main_dll.dylib            0x000000010a638a83 Browser::ActiveTabChanged(content::WebContents*, content::WebContents*, int, int) + 195
10  libchrome_main_dll.dylib            0x000000010a7475e3 TabStripModel::NotifyIfActiveTabChanged(content::WebContents*, TabStripModel::NotifyTypes) + 483
11  libchrome_main_dll.dylib            0x000000010a743041 TabStripModel::DetachWebContentsAt(int) + 2705
12  libchrome_main_dll.dylib            0x000000010a2c93f3 DestroyBrowserWebContents(Browser*) + 83
13  libchrome_main_dll.dylib            0x000000010a2c1373 BrowserFrameMac::OnWindowWillClose() + 51
14  libviews.dylib                      0x000000012d59958d views::BridgedNativeWidget::OnWindowWillClose() + 205
15  libviews.dylib                      0x000000012d5b38e5 -[ViewsNSWindowDelegate windowWillClose:] + 373
16  CoreFoundation                      0x00007fff8e7b5bbc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
17  CoreFoundation                      0x00007fff8e7b5b4f ___CFXRegistrationPost_block_invoke + 63
18  CoreFoundation                      0x00007fff8e7b5ac7 _CFXRegistrationPost + 407
19  CoreFoundation                      0x00007fff8e7b5832 ___CFXNotificationPost_block_invoke + 50
20  CoreFoundation                      0x00007fff8e7725e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
21  CoreFoundation                      0x00007fff8e771835 _CFXNotificationPost + 693
22  Foundation                          0x00007fff9a65afda -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
23  AppKit                              0x00007fff9c17b2df __18-[NSWindow _close]_block_invoke + 184
24  AppKit                              0x00007fff9c17b1e1 -[NSWindow _close] + 374
25  AppKit                              0x00007fff9c214ea1 -[NSWindow __close] + 312
26  libsystem_trace.dylib               0x00007fff90f1207a _os_activity_initiate + 75
27  AppKit                              0x00007fff9c12fe89 -[NSApplication sendAction:to:from:] + 460
28  libchrome_main_dll.dylib            0x0000000106ff987d -[BrowserCrApplication sendAction:to:from:] + 1085
29  AppKit                              0x00007fff9c141fde -[NSControl sendAction:to:] + 86
30  AppKit                              0x00007fff9c141f08 __26-[NSCell _sendActionFrom:]_block_invoke + 131
31  libsystem_trace.dylib               0x00007fff90f1207a _os_activity_initiate + 75
32  AppKit                              0x00007fff9c141e65 -[NSCell _sendActionFrom:] + 144
33  libsystem_trace.dylib               0x00007fff90f1207a _os_activity_initiate + 75
34  AppKit                              0x00007fff9c14048a -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2693
35  AppKit                              0x00007fff9c188fd0 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 744
36  AppKit                              0x00007fff9c13ebb4 -[NSControl mouseDown:] + 669
37  AppKit                              0x00007fff9c1ea20a -[_NSThemeWidget mouseDown:] + 87
38  AppKit                              0x00007fff9c693469 -[NSWindow _handleMouseDownEvent:isDelayedEvent:] + 6322
39  AppKit                              0x00007fff9c69444d -[NSWindow _reallySendEvent:isDelayedEvent:] + 212
40  AppKit                              0x00007fff9c0d363d -[NSWindow sendEvent:] + 517
41  libviews.dylib                      0x000000012d5b1287 -[NativeWidgetMacNSWindow sendEvent:] + 199
42  AppKit                              0x00007fff9c053b3c -[NSApplication sendEvent:] + 2540
43  libchrome_main_dll.dylib            0x0000000106ff9b73 __34-[BrowserCrApplication sendEvent:]_block_invoke + 259
44  libbase.dylib                       0x000000011664b2da base::mac::CallWithEHFrame(void () block_pointer) + 10
45  libchrome_main_dll.dylib            0x0000000106ff9a4d -[BrowserCrApplication sendEvent:] + 109
46  AppKit                              0x00007fff9bebaef6 -[NSApplication run] + 796
 
Labels: -Hotlist-MacViews Proj-MacViews
What steps will reproduce the problem:

For crash just open chromium, open second tab, switch to first tab and press red
"traffic light" button.

The CL https://codereview.chromium.org/2375903002/
Project Member

Comment 3 by bugdroid1@chromium.org, Oct 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f7941c454c74e229cedc6b3aed96bee9b3f22e68

commit f7941c454c74e229cedc6b3aed96bee9b3f22e68
Author: yamaxim <yamaxim@yandex-team.ru>
Date: Thu Oct 06 21:05:44 2016

MacViews: Emit OnNativeWidgetDestroying() before clearing the
NSWindowDelegate.

Currently the NSWindowDelegate is cleared beforehand, which
means observers of OnWidgetDestroying() are unable to use
GetWidgetForNativeWindow(). This is a problem during closure of
the browser window because inactive tabs are reattached when they
become active due to the active tab being closed. This results in a
DCHECK in NativeViewHostMac::AttachNativeView().

To fix, clear the NSWindowDelegate in the method
BridgedNativeWidget calls on NativeWidgetMac which deletes the
BridgedNativeWidget instance (i.e. just after emitting
OnNativeWidgetDestroying()).

R=tapted@chromium.org

BUG= 604628 

Review-Url: https://codereview.chromium.org/2375903002
Cr-Commit-Position: refs/heads/master@{#423676}

[modify] https://crrev.com/f7941c454c74e229cedc6b3aed96bee9b3f22e68/ui/views/cocoa/bridged_native_widget.mm
[modify] https://crrev.com/f7941c454c74e229cedc6b3aed96bee9b3f22e68/ui/views/widget/native_widget_mac.mm
[modify] https://crrev.com/f7941c454c74e229cedc6b3aed96bee9b3f22e68/ui/views/widget/widget_unittest.cc

Status: Fixed (was: Available)
Project Member

Comment 5 by bugdroid1@chromium.org, Oct 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/76adce4f223e7342acc632cd5abe181eb4751d99

commit 76adce4f223e7342acc632cd5abe181eb4751d99
Author: tapted <tapted@chromium.org>
Date: Thu Oct 20 04:49:59 2016

MacViews: Implement CloseNow() as just -[NSWindow close].

This simplifies the teardown codepaths and increases parity with
NativeWidgetAura by increasing the separation between the calls to
OnNativeWidgetDestroying() and  OnNativeWidgetDestroyed().

Previously NativeWidgetMac relied on different ways of calling `delete`
on a BridgedNativeWidget in order to perform a synchronous close of the
window in CloseNow(). Now it just calls -[NSWindow close], giving it the
same codepath as a native-triggered close (e.g. clicking the close
button in the window frame).

BUG= 604628 

Review-Url: https://chromiumcodereview.appspot.com/2393843002
Cr-Commit-Position: refs/heads/master@{#426407}

[modify] https://crrev.com/76adce4f223e7342acc632cd5abe181eb4751d99/ui/views/cocoa/bridged_native_widget.mm
[modify] https://crrev.com/76adce4f223e7342acc632cd5abe181eb4751d99/ui/views/cocoa/bridged_native_widget_unittest.mm
[modify] https://crrev.com/76adce4f223e7342acc632cd5abe181eb4751d99/ui/views/widget/native_widget_mac.h
[modify] https://crrev.com/76adce4f223e7342acc632cd5abe181eb4751d99/ui/views/widget/native_widget_mac.mm
[modify] https://crrev.com/76adce4f223e7342acc632cd5abe181eb4751d99/ui/views/widget/native_widget_mac_unittest.mm

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 27 2016

Labels: merge-merged-2840
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f7941c454c74e229cedc6b3aed96bee9b3f22e68

commit f7941c454c74e229cedc6b3aed96bee9b3f22e68
Author: yamaxim <yamaxim@yandex-team.ru>
Date: Thu Oct 06 21:05:44 2016

MacViews: Emit OnNativeWidgetDestroying() before clearing the
NSWindowDelegate.

Currently the NSWindowDelegate is cleared beforehand, which
means observers of OnWidgetDestroying() are unable to use
GetWidgetForNativeWindow(). This is a problem during closure of
the browser window because inactive tabs are reattached when they
become active due to the active tab being closed. This results in a
DCHECK in NativeViewHostMac::AttachNativeView().

To fix, clear the NSWindowDelegate in the method
BridgedNativeWidget calls on NativeWidgetMac which deletes the
BridgedNativeWidget instance (i.e. just after emitting
OnNativeWidgetDestroying()).

R=tapted@chromium.org

BUG= 604628 

Review-Url: https://codereview.chromium.org/2375903002
Cr-Commit-Position: refs/heads/master@{#423676}

[modify] https://crrev.com/f7941c454c74e229cedc6b3aed96bee9b3f22e68/ui/views/cocoa/bridged_native_widget.mm
[modify] https://crrev.com/f7941c454c74e229cedc6b3aed96bee9b3f22e68/ui/views/widget/native_widget_mac.mm
[modify] https://crrev.com/f7941c454c74e229cedc6b3aed96bee9b3f22e68/ui/views/widget/widget_unittest.cc

Comment 7 by dimu@google.com, Nov 4 2016

Labels: -merge-merged-2840
[Automated comment] removing mislabelled merge-merged-2840

Sign in to add a comment