| Index: views/widget/widget.cc
|
| diff --git a/views/widget/widget.cc b/views/widget/widget.cc
|
| index 07a6687a2eb13eb55aa613de75cb4e491245faa2..c8fa738961ba4e57ee0346bbcb13795b8332a6c6 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();
|
| @@ -856,12 +859,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;
|
| }
|
|
|