Check for GDI exhaustion if window creation fails

https://chromium-review.googlesource.com/c/chromium/src/+/2244124
This commit is contained in:
Deepak Mohan
2020-07-02 15:38:02 -07:00
parent d8b2ec85f7
commit 3d45d7b78c
3 changed files with 6 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
#include <windows.h>
#include <wtsapi32.h>
#include "base/win/windows_types.h"
#include "base/win/wrapped_window_proc.h"
#include "ui/base/win/shell.h"
#include "ui/gfx/win/hwnd_util.h"
@@ -34,7 +35,7 @@ void PowerMonitor::InitPlatformSpecificMonitors() {
// session lock and unlock events.
window_ = CreateWindow(MAKEINTATOM(atom_), 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0,
instance_, 0);
gfx::CheckWindowCreated(window_);
gfx::CheckWindowCreated(window_, ::GetLastError());
gfx::SetWindowUserData(window_, this);
// Tel windows we want to be notified with session events

View File

@@ -10,6 +10,7 @@
#include "shell/browser/api/electron_api_system_preferences.h"
#include "base/win/core_winrt_util.h"
#include "base/win/windows_types.h"
#include "base/win/wrapped_window_proc.h"
#include "shell/common/color_util.h"
#include "ui/base/win/shell.h"
@@ -209,7 +210,7 @@ void SystemPreferences::InitializeWindow() {
// receive broadcast messages like "WM_DWMCOLORIZATIONCOLORCHANGED".
window_ = CreateWindow(MAKEINTATOM(atom_), 0, WS_POPUP, 0, 0, 0, 0, 0, 0,
instance_, 0);
gfx::CheckWindowCreated(window_);
gfx::CheckWindowCreated(window_, ::GetLastError());
gfx::SetWindowUserData(window_, this);
}

View File

@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/win/win_util.h"
#include "base/win/windows_types.h"
#include "base/win/wrapped_window_proc.h"
#include "shell/browser/ui/win/notify_icon.h"
#include "ui/events/event_constants.h"
@@ -69,7 +70,7 @@ NotifyIconHost::NotifyIconHost() {
// "TaskbarCreated".
window_ = CreateWindow(MAKEINTATOM(atom_), 0, WS_POPUP, 0, 0, 0, 0, 0, 0,
instance_, 0);
gfx::CheckWindowCreated(window_);
gfx::CheckWindowCreated(window_, ::GetLastError());
gfx::SetWindowUserData(window_, this);
}