CefLifeSpanHandler::OnBeforeClose not being called in 90.0.4430.85 on OS X

Issue #3118 resolved
Vitaliy Yunikov created an issue

This issue can be easily reproduced with cefsimple.

Steps:

  1. Run cefsimple and wait for the window to show up
  2. Close the window

Expected:

  • CEF does a usual cleanup process and app shuts down

Actual:

  • App never shuts down
  • What happens is CefLifeSpanHandler::DoClose is called as expected when window is closed, but CefLifeSpanHandler::OnBeforeCloseis never called afterwards.
  • In my own application, if I ignore a missing call to CefLifeSpanHandler::OnBeforeClose, and clean things up after CefLifeSpanHandler::DoClose, app crashes on CefShutdown due to extra reference to CefLifeSpanHandler

Comments (9)

  1. Marshall Greenblatt

    What MacOS and Xcode version? Are you using the official Spotify builds? Does the problem reproduce with older or newer CEF versions?

  2. Marshall Greenblatt

    I’m able to reproduce this (or a similar problem) with current master (M91). It appears to only be an issue with cefsimple native mode. It does not reproduce with cefsimple --use-views or cefclient.

  3. Vitaliy Yunikov reporter

    Yes, you are right, that’s an issue with running in native mode.

    It does not reproduce with cefsimple --use-views

    Are views supported on Mac? I recall they have only been supported on Windows and Linux?

    Also, for reference I am on Mac OS 10.15.7, XCode 12

  4. Marshall Greenblatt

    Looks like this problem started with 90.5.1+g7823df5. Works as expected with 90.4.3+gc48a797. That makes 691c9c2 the likely culprit.

  5. Marshall Greenblatt

    After the above commit we are executing CefBrowserPlatformDelegateNativeMac::CreateHostWindow from inside OnContextCreated (via CreateBrowser) instead of posting it async on the UI thread as was done previously. As a result the CefBrowserHostView created in CreateHostWindow was not being deleted and consequently WindowDestroyed was not being called. We should return to always making the async posting for CreateBrowser.

  6. Marshall Greenblatt

    Restore async CreateBrowser behavior (fixes issue #3116, fixes issue #3118)

    Restore the async CreateBrowser behavior that existed prior to commit 691c9c2 because executing synchronously (for example, from inside OnContextInitialized) causes issues on MacOS and possibly other platforms.

    → <<cset 2de07250dc6c>>

  7. Marshall Greenblatt

    Restore async CreateBrowser behavior (fixes issue #3116, fixes issue #3118)

    Restore the async CreateBrowser behavior that existed prior to commit 691c9c2 because executing synchronously (for example, from inside OnContextInitialized) causes issues on MacOS and possibly other platforms.

    → <<cset fae1e9eaa1b4>>

  8. Marshall Greenblatt

    Restore async CreateBrowser behavior (fixes issue #3116, fixes issue #3118)

    Restore the async CreateBrowser behavior that existed prior to commit 691c9c2 because executing synchronously (for example, from inside OnContextInitialized) causes issues on MacOS and possibly other platforms.

    → <<cset c53c523f4dea>>

  9. Log in to comment