I have the following scenario:
The windows are provided by the application and the browser window is parented to those windows.
For popups, they are initially parented to a temp window and then reparented to the actual window (as done in cefclient example).
All the application provided windows share the same class and the windowproc.
When I close the popup window the following sequence takes place:
- WM_CLOSE is received with hWnd of the popup window
- CefBrowserHost::CloseBrowser(false) is called
- DoClose is called on the popup browser
- IsClosing flag is set
- WM_CLOSE returns 0 to cancel the close.
- WM_CLOSE is received again with hWnd of the popup window
- Since the IsClosing flag is set, the WM_CLOSE is handled by the DefWndProc
- The popup window is closed
- OnBeforeClose is called for the popup browser
Till here everything is working just fine.
The problem I am having is that OnBeforeClose is called again for the main browser (IsPopup == false) which is causing the CefQuitMessageLoop to be called and shutting down the entire application.
I am not sure why OnBeforeClose is being called twice. I am not able to track why the main window/browser receives a shutdown event.