From 3d5ae838ca225653895179504a1eb5b02f2cd77a Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 31 Aug 2017 18:10:51 -0400 Subject: [PATCH] Windows: Wait for WM_NCDESTROY before calling OnBeforeClose (issue #2248) --- libcef/browser/native/browser_platform_delegate_native_win.cc | 4 ++-- .../cefclient/browser/main_message_loop_multithreaded_win.cc | 2 +- tests/cefclient/browser/root_window_win.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index 906e5d43d..26fea945d 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -594,7 +594,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd, // Allow the close. break; - case WM_DESTROY: + case WM_NCDESTROY: if (platform_delegate) { // Clear the user data pointer. gfx::SetWindowUserData(hwnd, NULL); @@ -604,7 +604,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd, // CreateHostWindow(). browser->WindowDestroyed(); } - return 0; + break; case WM_SIZE: if (platform_delegate && platform_delegate->window_widget_) { diff --git a/tests/cefclient/browser/main_message_loop_multithreaded_win.cc b/tests/cefclient/browser/main_message_loop_multithreaded_win.cc index a8aa6f3bf..39912ceaf 100644 --- a/tests/cefclient/browser/main_message_loop_multithreaded_win.cc +++ b/tests/cefclient/browser/main_message_loop_multithreaded_win.cc @@ -140,7 +140,7 @@ MainMessageLoopMultithreadedWin::MessageWndProc(HWND hWnd, task->Release(); } else { switch (message) { - case WM_DESTROY: + case WM_NCDESTROY: // Clear the reference to |self|. SetUserDataPtr(hWnd, NULL); break; diff --git a/tests/cefclient/browser/root_window_win.cc b/tests/cefclient/browser/root_window_win.cc index 1cf4a3764..fa77e6c96 100644 --- a/tests/cefclient/browser/root_window_win.cc +++ b/tests/cefclient/browser/root_window_win.cc @@ -614,7 +614,7 @@ LRESULT CALLBACK RootWindowWin::RootWndProc(HWND hWnd, SetUserDataPtr(hWnd, NULL); self->hwnd_ = NULL; self->OnDestroyed(); - return 0; + break; } return DefWindowProc(hWnd, message, wParam, lParam);