-
Notifications
You must be signed in to change notification settings - Fork 566
Description
Describe the bug
When the host/parent window is destroyed, neither is the browser instance destroyed, nor getting any callback.
This also happens on window managers that are directly destroying the window, instead of just politely asking the client to do this itself.
To Reproduce
- add OnBeforeClose() handler and
a) kill the host window (calling X_DestroyWindow)
b) kill the browser window (calling X_DestroyWindow)
b) use some really tiny WM that's directly calling X_DestroyWindow
and see that neither callback is called, nor the browser object destroyed
Expected behavior
Browser instance should be closed, and OnBeforeClose() callback should be called right before that, when the browser window (or it's parent) is destroyed.
Versions (please complete the following information):
- OS: Devuan Daedalus
- CEF Version: feddd22
Additional context
- CefWindowX11::OnEvent() needs to handle x11::DestroyNotifyEvent
- calling CloseBrowser(true) doesn't help here
- need listen to SubstructureNotify event
- CEF's own child window needs to be additionally recorded in CefWindowX11 and GetHost() needs to check for it, too
In the longer term, a clean implementation would be throwing away the complicated recursive CloseBrowser() calls, especially NOT sending WM_DELETE_WINDOW to ourselves (WTF ?! this really isn't what that message is designed for - it's just for window managers signaling the user's intent to close a window, eg. allow the client to ask for confirmation, save some date, etc ... the Xserver itself has no business with this message at all).
There should be two separate API functions, one for signling the close-intent (where user might be asked for confirmation, etc) and one for actually destroying it no matter what.