Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac: views: Shutdown crash after popup due to zombie NSWindow object #3602

Closed
magreenblatt opened this issue Nov 13, 2023 · 4 comments
Closed
Labels
bug Bug report macos MacOS platform views Related to the Views framework

Comments

@magreenblatt
Copy link
Collaborator

magreenblatt commented Nov 13, 2023

Describe the bug
Cefclient on MacOS crashes on exit after showing a Views-hosted popup window and then closing all windows.

To Reproduce
Steps to reproduce the behavior:

  1. Run cefclient --enable-chrome-runtime or cefclient --use-views
  2. Select Tests > Popup Window
  3. Close all windows manually (click the red traffic light button) or via the application menu (Cmd-Q).

Expected behavior
Application should exit cleanly. Instead, get the following crash:

Backtrace from -dealloc:
0   Chromium Embedded Framework         0x00000001c426ddb9 (anonymous namespace)::ZombieDealloc(objc_object*, objc_selector*) + 585
1   AppKit                              0x00007ff80ee89738 -[NSResponder dealloc] + 433
2   AppKit                              0x00007ff80f08e832 -[NSWindow dealloc] + 2892
3   libobjc.A.dylib                     0x00007ff80b3914d3 AutoreleasePoolPage::releaseUntil(objc_object**) + 169
4   libobjc.A.dylib                     0x00007ff80b38e7e3 objc_autoreleasePoolPop + 235
5   Chromium Embedded Framework         0x00000001bf108dcd base::apple::ScopedNSAutoreleasePool::PopImpl() + 1565
6   Chromium Embedded Framework         0x00000001bf108711 base::apple::ScopedNSAutoreleasePool::~ScopedNSAutoreleasePool() + 65
7   Chromium Embedded Framework         0x00000001bf108e45 base::apple::ScopedNSAutoreleasePool::~ScopedNSAutoreleasePool() + 21
8   Chromium Embedded Framework         0x00000001bf110cba absl::optional_internal::optional_data_dtor_base<base::apple::ScopedNSAutoreleasePool, false>::destruct() + 42
9   Chromium Embedded Framework         0x00000001bf110d95 absl::optional_internal::optional_data_dtor_base<base::apple::ScopedNSAutoreleasePool, false>::~optional_data_dtor_base() + 21
10  Chromium Embedded Framework         0x00000001bf110d75 absl::optional_internal::optional_data_base<base::apple::ScopedNSAutoreleasePool>::~optional_data_base() + 21
11  Chromium Embedded Framework         0x00000001bf110d55 absl::optional_internal::optional_data<base::apple::ScopedNSAutoreleasePool, false>::~optional_data() + 21
12  Chromium Embedded Framework         0x00000001bf110d35 absl::optional<base::apple::ScopedNSAutoreleasePool>::~optional() + 21
13  Chromium Embedded Framework         0x00000001bf110bf5 absl::optional<base::apple::ScopedNSAutoreleasePool>::~optional() + 21
14  Chromium Embedded Framework         0x00000001bf110db5 base::OptionalAutoreleasePool::~OptionalAutoreleasePool() + 21
15  Chromium Embedded Framework         0x00000001bf10dfd5 base::OptionalAutoreleasePool::~OptionalAutoreleasePool() + 21
16  Chromium Embedded Framework         0x00000001bf10dee3 base::MessagePumpCFRunLoopBase::RunWork() + 499
17  Chromium Embedded Framework         0x00000001bf10df69 ___ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv_block_invoke + 25
18  Chromium Embedded Framework         0x00000001bf10b9e2 base::apple::CallWithEHFrame(void () block_pointer) + 10
19  Chromium Embedded Framework         0x00000001bf10cb20 base::MessagePumpCFRunLoopBase::RunWorkSource(void*) + 112
[3599:259:1111/211018.202572:FATAL:objc_zombie.mm(251)] Zombie <NSWindow: 0x7ff6dab988f0> received -release

Versions (please complete the following information):

  • OS: MacOS 14.1.1 (23B81)
  • CEF Version: 119.3.1+gf768881+chromium-119.0.6045.124

Additional context
The order of manually closing the windows makes no difference.

Does not reproduce with --use-default-popup.

@magreenblatt magreenblatt added bug Bug report macos MacOS platform chrome Related to the Chrome runtime views Related to the Views framework labels Nov 13, 2023
@magreenblatt
Copy link
Collaborator Author

magreenblatt commented Nov 13, 2023

-[NSResponder dealloc]

NSWindow is an NSResponder.

@magreenblatt magreenblatt changed the title chrome: mac: views: Shutdown crash after popup due to zombie NSWindow object chrome: mac: views: Shutdown crash after popup due to zombie NSView object Nov 13, 2023
@magreenblatt magreenblatt changed the title chrome: mac: views: Shutdown crash after popup due to zombie NSView object chrome: mac: views: Shutdown crash after popup due to zombie NSWindow object Nov 13, 2023
@magreenblatt
Copy link
Collaborator Author

Also reproduces with Alloy runtime (cefclient --use-views)

@magreenblatt magreenblatt changed the title chrome: mac: views: Shutdown crash after popup due to zombie NSWindow object mac: views: Shutdown crash after popup due to zombie NSWindow object Nov 13, 2023
@magreenblatt magreenblatt removed the chrome Related to the Chrome runtime label Nov 13, 2023
@magreenblatt
Copy link
Collaborator Author

magreenblatt commented Jul 12, 2024

With M127 the behavior is as follows:

Mode Popup DevTools Description
cefclient NOK NOK Chrome style; Views-hosted window
cefclient --use-alloy-style NOK NOK Alloy style; Views-hosted window
cefclient --use-native NOK OK Alloy style; Native-hosted window
cefclient --off-screen-rendering-enabled NOK OK Alloy style; Native-hosted window; Windowless rendering
cefsimple OK [1] OK Chrome style; Views-hosted window
cefsimple --use-alloy-style OK [1] - Alloy style; Views-hosted window
cefsimple --use-alloy-style --use-native OK [1] - Alloy style; Native-hosted window
cefsimple --use-native OK [2] OK Chrome style; Full Chrome UI

[1] Tested with --url="https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open"
[2] Tested by entering javascript:window.open('https://www.google.com') in the omnibox

@magreenblatt
Copy link
Collaborator Author

magreenblatt commented Jul 15, 2024

The problem appears to be calling close on the NSWindow created by TempWindowMacImpl.

From here:

Just calling close() can make several issues. If your NSWindow instance haven't been open, calling close() causes an exception of sending release message to deallocated object. You can check it with Zombies-on.

magreenblatt added a commit that referenced this issue Jul 16, 2024
- Don't create a TempWindow when using Views.
- Don't call `close` on an NSWindow that is never opened.
magreenblatt added a commit that referenced this issue Jul 16, 2024
- Don't create a TempWindow when using Views.
- Don't call `close` on an NSWindow that is never opened.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report macos MacOS platform views Related to the Views framework
Projects
None yet
Development

No branches or pull requests

1 participant