| Index: ui/platform_window/x11/x11_window.cc
|
| diff --git a/ui/platform_window/x11/x11_window.cc b/ui/platform_window/x11/x11_window.cc
|
| index 14e6fdf0b282421af5e88e7bf8c6c27032543337..5e8f41118b95f3b1b083c0f31d5b1948957f8ff5 100644
|
| --- a/ui/platform_window/x11/x11_window.cc
|
| +++ b/ui/platform_window/x11/x11_window.cc
|
| @@ -46,7 +46,8 @@ X11Window::X11Window(PlatformWindowDelegate* delegate)
|
| xwindow_(None),
|
| xroot_window_(DefaultRootWindow(xdisplay_)),
|
| atom_cache_(xdisplay_, kAtomsToCache),
|
| - window_mapped_(false) {
|
| + window_mapped_(false),
|
| + destroyed_(false) {
|
| CHECK(delegate_);
|
| TouchFactory::SetTouchDeviceListFromCommandLine();
|
| }
|
| @@ -56,14 +57,20 @@ X11Window::~X11Window() {
|
| }
|
|
|
| void X11Window::Destroy() {
|
| - delegate_->OnClosed();
|
| - if (xwindow_ == None)
|
| + if (destroyed_)
|
| return;
|
|
|
| - // Stop processing events.
|
| - PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
| - XDestroyWindow(xdisplay_, xwindow_);
|
| - xwindow_ = None;
|
| + destroyed_ = true;
|
| +
|
| + if (xwindow_ != None) {
|
| + // Stop processing events.
|
| + PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
| + XDestroyWindow(xdisplay_, xwindow_);
|
| + xwindow_ = None;
|
| + }
|
| +
|
| + delegate_->OnClosed();
|
| + // |this| could be deleted now.
|
| }
|
|
|
| void X11Window::ProcessXInput2Event(XEvent* xev) {
|
|
|