Skip to content

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

Closed

Description

@magreenblatt

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.

Activity

  1. added
    bug
    macos
    chrome
    views
    on Nov 13, 2023
  2. magreenblatt commented on Nov 13, 2023

    @magreenblatt
    CollaboratorAuthor

    -[NSResponder dealloc]

    NSWindow is an NSResponder.

  3. 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[/+] on Nov 13, 2023
  4. 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[/+] on Nov 13, 2023
  5. magreenblatt commented on Nov 13, 2023

    @magreenblatt
    CollaboratorAuthor

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

  6. 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[/+] on Nov 13, 2023
  7. removed
    chrome
    on Nov 13, 2023
  8. magreenblatt commented on Jul 12, 2024

    @magreenblatt
    CollaboratorAuthor

    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

  9. magreenblatt commented on Jul 15, 2024

    @magreenblatt
    CollaboratorAuthor

    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.

  10. added a commit that references this issue on Jul 16, 2024
    d96e29b
  11. added a commit that references this issue on Jul 16, 2024
    239742e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmacosviews

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions