| Index: ui/aura/desktop_host_linux.cc
|
| diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc
|
| index 9934467fcbb2b8b49208f0a45a5fcdf60137d293..48dcf7f9800e1f586d0dfbf372a65bb6a2c0d820 100644
|
| --- a/ui/aura/desktop_host_linux.cc
|
| +++ b/ui/aura/desktop_host_linux.cc
|
| @@ -222,13 +222,14 @@ bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
|
| }
|
| }
|
|
|
| -class DesktopHostLinux : public DesktopHost {
|
| +class DesktopHostLinux : public DesktopHost,
|
| + public MessageLoop::DestructionObserver {
|
| public:
|
| explicit DesktopHostLinux(const gfx::Rect& bounds);
|
| virtual ~DesktopHostLinux();
|
|
|
| private:
|
| - // base::MessageLoop::Dispatcher Override.
|
| + // MessageLoop::Dispatcher Override.
|
| virtual DispatchStatus Dispatch(XEvent* xev) OVERRIDE;
|
|
|
| // DesktopHost Overrides.
|
| @@ -243,6 +244,9 @@ class DesktopHostLinux : public DesktopHost {
|
| virtual gfx::Point QueryMouseLocation() OVERRIDE;
|
| virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE;
|
|
|
| + // MessageLoop::DestructionObserver Overrides.
|
| + virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
|
| +
|
| // Returns true if there's an X window manager present... in most cases. Some
|
| // window managers (notably, ion3) don't implement enough of ICCCM for us to
|
| // detect that they're there.
|
| @@ -292,6 +296,9 @@ DesktopHostLinux::DesktopHostLinux(const gfx::Rect& bounds)
|
| if (base::MessagePumpForUI::HasXInput2())
|
| ui::TouchFactory::GetInstance()->SetupXI2ForXWindow(xwindow_);
|
| #endif
|
| +
|
| + base::MessagePumpX::SetDefaultDispatcher(this);
|
| + MessageLoopForUI::current()->AddDestructionObserver(this);
|
| }
|
|
|
| DesktopHostLinux::~DesktopHostLinux() {
|
| @@ -299,6 +306,9 @@ DesktopHostLinux::~DesktopHostLinux() {
|
|
|
| // Clears XCursorCache.
|
| ui::GetXCursor(ui::kCursorClearXCursorCache);
|
| +
|
| + MessageLoopForUI::current()->RemoveDestructionObserver(this);
|
| + base::MessagePumpX::SetDefaultDispatcher(NULL);
|
| }
|
|
|
| base::MessagePumpDispatcher::DispatchStatus DesktopHostLinux::Dispatch(
|
| @@ -534,6 +544,10 @@ void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) {
|
| DLOG(WARNING) << "PostEvent:" << xevent.type << ", status=" << status;
|
| }
|
|
|
| +void DesktopHostLinux::WillDestroyCurrentMessageLoop() {
|
| + desktop_->DeleteInstance();
|
| +}
|
| +
|
| bool DesktopHostLinux::IsWindowManagerPresent() {
|
| // Per ICCCM 2.8, "Manager Selections", window managers should take ownership
|
| // of WM_Sn selections (where n is a screen number).
|
|
|