Commit 492e495e authored by danakj@chromium.org's avatar danakj@chromium.org

aura: Destroy the compositor before destroying the backing window.

This was causing linux_aura single-process browser tests to crash since
they don't set up a default X error handler. When the compositor is
shutting down it does a finish and this might try to swap to the X
window.

Also change the windows shutdown ordering to match.

R=ben, enne
BUG=270918

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=245028

Review URL: https://codereview.chromium.org/132473007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245586 0039d316-1c4b-4281-b951-d872f2087c98
parent 2f18ff3d
......@@ -167,7 +167,10 @@ WindowTreeHost::WindowTreeHost()
: delegate_(NULL) {
}
void WindowTreeHost::DestroyCompositor() { compositor_.reset(); }
void WindowTreeHost::DestroyCompositor() {
DCHECK(GetAcceleratedWidget());
compositor_.reset();
}
void WindowTreeHost::CreateCompositor(
gfx::AcceleratedWidget accelerated_widget) {
......
......@@ -226,10 +226,14 @@ HICON WindowImpl::GetDefaultWindowIcon() const {
LRESULT WindowImpl::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
LRESULT result = 0;
HWND hwnd = hwnd_;
if (message == WM_NCDESTROY)
hwnd_ = NULL;
// Handle the message if it's in our message map; otherwise, let the system
// handle it.
if (!ProcessWindowMessage(hwnd_, message, w_param, l_param, result))
result = DefWindowProc(hwnd_, message, w_param, l_param);
if (!ProcessWindowMessage(hwnd, message, w_param, l_param, result))
result = DefWindowProc(hwnd, message, w_param, l_param);
return result;
}
......
......@@ -88,7 +88,6 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
}
DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() {
DestroyCompositor();
// WARNING: |content_window_| has been destroyed by the time we get here.
desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(
root_window_);
......@@ -770,6 +769,10 @@ void DesktopWindowTreeHostWin::HandleCreate() {
void DesktopWindowTreeHostWin::HandleDestroying() {
drag_drop_client_->OnNativeWidgetDestroying(GetHWND());
native_widget_delegate_->OnNativeWidgetDestroying();
// Destroy the compositor before destroying the HWND since shutdown
// may try to swap to the window.
DestroyCompositor();
}
void DesktopWindowTreeHostWin::HandleDestroyed() {
......
......@@ -142,7 +142,6 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
}
DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() {
DestroyCompositor();
root_window_->window()->ClearProperty(kHostForRootWindow);
aura::client::SetWindowMoveClient(root_window_->window(), NULL);
desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(root_window_);
......@@ -320,6 +319,11 @@ void DesktopWindowTreeHostX11::CloseNow() {
desktop_native_widget_aura_->root_window_event_filter()->RemoveHandler(
x11_window_event_filter_.get());
// Destroy the compositor before destroying the |xwindow_| since shutdown
// may try to swap, and the swap without a window causes an X error, which
// causes a crash with in-process renderer.
DestroyCompositor();
open_windows().remove(xwindow_);
// Actually free our native resources.
base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment