Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: ui/platform_window/x11/x11_window_ozone.cc

Issue 2741533002: Fix AshWindowTreeHost shutdown for Ozone X11. (Closed)
Patch Set: Add to other PlatformWindow implementations. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/platform_window/x11/x11_window_ozone.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/platform_window/x11/x11_window_ozone.cc
diff --git a/ui/platform_window/x11/x11_window_ozone.cc b/ui/platform_window/x11/x11_window_ozone.cc
index c3051cb5eafc49d4acc363a43f748488ede002db..c7a016e46f25755a679e1600b64f441f8b6fb4bd 100644
--- a/ui/platform_window/x11/x11_window_ozone.cc
+++ b/ui/platform_window/x11/x11_window_ozone.cc
@@ -16,22 +16,28 @@
namespace ui {
-X11WindowOzone::X11WindowOzone(X11EventSourceLibevent* event_source,
- X11WindowManagerOzone* window_manager,
+X11WindowOzone::X11WindowOzone(X11WindowManagerOzone* window_manager,
PlatformWindowDelegate* delegate,
const gfx::Rect& bounds)
- : X11WindowBase(delegate, bounds),
- event_source_(event_source),
- window_manager_(window_manager) {
- DCHECK(event_source_);
+ : X11WindowBase(delegate, bounds), window_manager_(window_manager) {
DCHECK(window_manager);
- event_source_->AddPlatformEventDispatcher(this);
- event_source_->AddXEventDispatcher(this);
+ auto* event_source = X11EventSourceLibevent::GetInstance();
+ if (event_source) {
+ event_source->AddPlatformEventDispatcher(this);
+ event_source->AddXEventDispatcher(this);
+ }
}
X11WindowOzone::~X11WindowOzone() {
- event_source_->RemovePlatformEventDispatcher(this);
- event_source_->RemoveXEventDispatcher(this);
+ X11WindowOzone::PrepareForShutdown();
+}
+
+void X11WindowOzone::PrepareForShutdown() {
+ auto* event_source = X11EventSourceLibevent::GetInstance();
+ if (event_source) {
+ event_source->RemovePlatformEventDispatcher(this);
+ event_source->RemoveXEventDispatcher(this);
+ }
}
void X11WindowOzone::SetCapture() {
« no previous file with comments | « ui/platform_window/x11/x11_window_ozone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698