diff options
-rw-r--r-- | ui/base/win/window_impl.cc | 6 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 8 | ||||
-rw-r--r-- | views/window/window_win.cc | 1 |
3 files changed, 10 insertions, 5 deletions
diff --git a/ui/base/win/window_impl.cc b/ui/base/win/window_impl.cc index 4cd54bd..0f48b89 100644 --- a/ui/base/win/window_impl.cc +++ b/ui/base/win/window_impl.cc @@ -147,10 +147,12 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) { hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), NULL, window_style_, x, y, width, height, parent, NULL, NULL, this); - DCHECK(hwnd_); + CHECK(hwnd_); // The window procedure should have set the data for us. - DCHECK(ui::GetWindowUserData(hwnd_) == this); + CHECK_EQ(this, ui::GetWindowUserData(hwnd_)); + + CHECK(IsWindowImpl(hwnd_)); } HICON WindowImpl::GetDefaultWindowIcon() const { diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 424386b..d462226 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -602,9 +602,10 @@ void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) { } LRESULT WidgetWin::OnCreate(CREATESTRUCT* create_struct) { - // Widget::GetWidgetFromNativeView expects the contents of this property - // to be of type Widget, so the cast is necessary. + CHECK(hwnd()); + CHECK(ui::WindowImpl::IsWindowImpl(hwnd())); SetNativeWindowProperty(kNativeWidgetKey, this); + CHECK_EQ(this, GetNativeWidgetForNativeView(hwnd())); use_layered_buffer_ = !!(window_ex_style() & WS_EX_LAYERED); @@ -1217,6 +1218,9 @@ NativeWidget* NativeWidget::GetTopLevelNativeWidgetWithReason( } } while (parent_hwnd != NULL && parent_widget != NULL); + if (!widget && !ui::WindowImpl::IsWindowImpl(native_view)) + *reason = 1000; + return widget; } diff --git a/views/window/window_win.cc b/views/window/window_win.cc index df9ca69..eddd2bb 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -331,7 +331,6 @@ void WindowWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) { WidgetWin::Init(parent, bounds); - ui::SetWindowUserData(GetNativeView(), this); delegate_->OnNativeWindowCreated(bounds); } |