Index: mojo/examples/window_manager/window_manager.cc |
diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc |
index 0771cdc442e07f209ae8036a598f0707205b3d1e..9abc98922b1b6527bda6841cdc18e13f644034b9 100644 |
--- a/mojo/examples/window_manager/window_manager.cc |
+++ b/mojo/examples/window_manager/window_manager.cc |
@@ -265,7 +265,10 @@ class WindowManager |
app_(NULL) {} |
virtual ~WindowManager() { |
- window_manager_app_->host()->window()->RemovePreTargetHandler(this); |
+ // host() may be destroyed by the time we get here. |
+ // TODO: figure out a way to always cleanly remove handler. |
+ if (window_manager_app_->host()) |
+ window_manager_app_->host()->window()->RemovePreTargetHandler(this); |
} |
void CloseWindow(Id view_id) { |