OnBeforeClose - last notification that references browser?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

OnBeforeClose - last notification that references browser?

Postby Czarek » Sat Mar 18, 2017 3:32 pm

A doc comment in CefLifeSpanHandler::OnBeforeClose says that this callback will be the last notification that references |browser|. Do I understand it correctly that no other handlers' callbacks will be executed after OnBeforeClose?

If so then it doesn't always behave correctly, because sometimes I'm seeing that CefJSDialogHandler::OnResetDialogState and/or CefRequestContextHandler::GetCookieManager are called after OnBeforeClose.

I am also experiencing some other issue, not sure if this is related. Sometimes I am also seeing calls to CefRenderProcessHandler::OnContextReleased in the renderer process after OnBeforeClose was called. In OnBeforeClose when last browser is closed I am releasing a shared request context and during that release a segmentation fault once occured in cef_ref_counted.h. Maybe I should never release a shared request context to avoid such issue?

Testing on Linux, branch 2924.

Doc comment for OnBeforeClose:
Code: Select all
///
  // Called just before a browser is destroyed. Release all references to the
  // browser object and do not attempt to execute any methods on the browser
  // object after this callback returns. This callback will be the last
  // notification that references |browser|. See DoClose() documentation for
  // additional usage information.
  ///
  /*--cef()--*/
  virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) {}
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 23 guests