Index: mojo/services/native_viewport/native_viewport_service.cc |
diff --git a/mojo/services/native_viewport/native_viewport_service.cc b/mojo/services/native_viewport/native_viewport_service.cc |
index 5625aa13935485f8b2a6cbcb47a8dd95c4a53ae5..9585ae7da0fcc8d3ccda4e6b00ca97a9fb25c6b8 100644 |
--- a/mojo/services/native_viewport/native_viewport_service.cc |
+++ b/mojo/services/native_viewport/native_viewport_service.cc |
@@ -36,7 +36,11 @@ class NativeViewportImpl |
NativeViewportImpl() |
: widget_(gfx::kNullAcceleratedWidget), |
waiting_for_event_ack_(false) {} |
- virtual ~NativeViewportImpl() {} |
+ virtual ~NativeViewportImpl() { |
+ // Destroy the NativeViewport early on as it may call us back during |
+ // destruction and we want to be in a known state. |
+ native_viewport_.reset(); |
+ } |
virtual void Create(const Rect& bounds) OVERRIDE { |
native_viewport_ = |