summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 04:00:50 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-25 04:00:50 +0000
commitad6a44b182cfac5b022b6722fcb1e56293eb2a34 (patch)
tree8758d09f0e3b1b9ff1a9bd2decc3d752c32a9864 /views
parent2c6ba36933e03b2ce7dfed10f5a8ca6f77f46a2d (diff)
downloadchromium_src-ad6a44b182cfac5b022b6722fcb1e56293eb2a34.zip
chromium_src-ad6a44b182cfac5b022b6722fcb1e56293eb2a34.tar.gz
chromium_src-ad6a44b182cfac5b022b6722fcb1e56293eb2a34.tar.bz2
Adds yet more debugging in hopes of tracking 91396. The latest data
indicates FindPreference is returning NULL and we're in shutdown because the last window is being closed. I suspect that for some reason on some machines this triggers us to get a WM_CLOSE after we've removed the property used to lookup the profile (removed in WM_DESTROY) so that we fall back to the local state prefs which don't have a property for window position and we crash. I'm adding debugging code to determine whether that is in fact happening. BUG=91396 TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/7727001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/widget.cc10
-rw-r--r--views/widget/widget.h20
2 files changed, 29 insertions, 1 deletions
diff --git a/views/widget/widget.cc b/views/widget/widget.cc
index 45423c6..12956ee 100644
--- a/views/widget/widget.cc
+++ b/views/widget/widget.cc
@@ -153,10 +153,13 @@ Widget::Widget()
saved_maximized_state_(false),
minimum_size_(100, 100),
focus_on_creation_(true),
- is_top_level_(false) {
+ is_top_level_(false),
+ destroy_state_(DESTROY_STATE_NONE) {
}
Widget::~Widget() {
+ destroy_state_ = DESTROY_STATE_DELETED;
+
while (!event_stack_.empty()) {
event_stack_.top()->reset();
event_stack_.pop();
@@ -862,12 +865,17 @@ void Widget::OnNativeWidgetCreated() {
void Widget::OnNativeWidgetDestroying() {
FOR_EACH_OBSERVER(Observer, observers_, OnWidgetClosing(this));
+ if (destroy_state_ == DESTROY_STATE_NONE)
+ destroy_state_ = DESTROY_STATE_IN_DESTROYING;
if (non_client_view_)
non_client_view_->WindowClosing();
widget_delegate_->WindowClosing();
}
void Widget::OnNativeWidgetDestroyed() {
+ if (destroy_state_ == DESTROY_STATE_IN_DESTROYING ||
+ destroy_state_ == DESTROY_STATE_NONE)
+ destroy_state_ = DESTROY_STATE_DESTROYED;
widget_delegate_->DeleteDelegate();
widget_delegate_ = NULL;
}
diff --git a/views/widget/widget.h b/views/widget/widget.h
index a85b619..70e527c 100644
--- a/views/widget/widget.h
+++ b/views/widget/widget.h
@@ -101,6 +101,20 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
typedef std::set<Widget*> Widgets;
+ enum DestroyState {
+ // The default, everything is good and alive.
+ DESTROY_STATE_NONE = 1,
+
+ // Set once OnNativeWidgetDestroying has been invoked.
+ DESTROY_STATE_IN_DESTROYING,
+
+ // Set once OnNativeWidgetDestroyed has been invoked.
+ DESTROY_STATE_DESTROYED,
+
+ // Set once the destructor is invoked.
+ DESTROY_STATE_DELETED,
+ };
+
enum FrameType {
FRAME_TYPE_DEFAULT, // Use whatever the default would be.
FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame.
@@ -564,6 +578,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// TYPE_CONTROL and TYPE_TOOLTIP is not considered top level.
bool is_top_level() const { return is_top_level_; }
+ DestroyState destroy_state() const { return destroy_state_; }
+
// Overridden from NativeWidgetDelegate:
virtual bool IsModal() const OVERRIDE;
virtual bool IsDialogBox() const OVERRIDE;
@@ -727,6 +743,10 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Factory used to create Compositors. Settable by tests.
static ui::Compositor*(*compositor_factory_)();
+ // Tracks destroy state.
+ // TODO(sky): remove this, used in tracking 91396.
+ DestroyState destroy_state_;
+
DISALLOW_COPY_AND_ASSIGN(Widget);
};