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

Issue 7741044: Fixes crash in SaveWindowPlacement. It's possible to get a WM_CLOSE (Closed)

Created:
9 years, 4 months ago by sky
Modified:
9 years, 3 months ago
CC:
chromium-reviews, dhollowa
Visibility:
Public.

Description

Fixes crash in SaveWindowPlacement. It's possible to get a WM_CLOSE after a WM_DESTROY. The current code in WM_DESTROY removes the properties, which means if we get a WM_CLOSE after WM_DESTROY we can't locate the profile and end up using local_state prefs, which haven't had the pref registered and we crash. The fix is to remove the properties in OnFinalMessage. BUG=91396 TEST=none R=ben@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98633

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -2 lines) Patch
M views/widget/native_widget_win.cc View 2 chunks +3 lines, -2 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
sky
9 years, 4 months ago (2011-08-26 16:05:05 UTC) #1
Ben Goodger (Google)
9 years, 4 months ago (2011-08-26 16:06:09 UTC) #2
LGTM

On Fri, Aug 26, 2011 at 9:05 AM, <sky@chromium.org> wrote:

> Reviewers: Ben Goodger (Google),
>
> Description:
> Fixes crash in SaveWindowPlacement. It's possible to get a WM_CLOSE
> after a WM_DESTROY. The current code in WM_DESTROY removes the
> properties, which means if we get a WM_CLOSE after WM_DESTROY we can't
> locate the profile and end up using local_state prefs, which haven't
> had the pref registered and we crash. The fix is to remove the
> properties in OnFinalMessage.
>
> BUG=91396
> TEST=none
> R=ben@chromium.org
>
>
> Please review this at
http://codereview.chromium.**org/7741044/<http://codereview.chromium.org/7741...
>
> SVN Base:
svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src>
>
> Affected files:
>  M views/widget/native_widget_**win.cc
>
>
> Index: views/widget/native_widget_**win.cc
> diff --git a/views/widget/native_widget_**win.cc
> b/views/widget/native_widget_**win.cc
> index 8c20b03447cc2f7ba6c215f3332846**583e3806ec..**
> e6f0896421230fe933b51b556b9d99**b14d79fdcd 100644
> --- a/views/widget/native_widget_**win.cc
> +++ b/views/widget/native_widget_**win.cc
> @@ -1270,8 +1270,6 @@ void NativeWidgetWin::OnDestroy() {
>     RevokeDragDrop(hwnd());
>     drop_target_ = NULL;
>   }
> -
> -  props_.reset();
>  }
>
>  void NativeWidgetWin::**OnDisplayChange(UINT bits_per_pixel, CSize
> screen_size) {
> @@ -2050,6 +2048,9 @@ void NativeWidgetWin::**OnWindowPosChanged(WINDOWPOS*
> window_pos) {
>  }
>
>  void NativeWidgetWin::**OnFinalMessage(HWND window) {
> +  // We don't destroy props in WM_DESTROY as we may still get messages
> after
> +  // WM_DESTROY that assume the properties are still valid (such as
> WM_CLOSE).
> +  props_.reset();
>   delegate_->**OnNativeWidgetDestroyed();
>   if (ownership_ == Widget::InitParams::NATIVE_**WIDGET_OWNS_WIDGET)
>     delete this;
>
>
>

Powered by Google App Engine
This is Rietveld 408576698