Commit 7fa245c0 by Geoff Lang

Use a new class name for each window.

If a previous window was not cleaned up properly due to a crash in a test, the subsequent windows can fail to be created because the class is not destroyed. Work around this by always creating a unique class before creating the window. Change-Id: Ied6b2818ef03fa12b07111d8204c3c1a6a5bd5ac Reviewed-on: https://chromium-review.googlesource.com/225080Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b5e17750
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "win32/Win32Window.h" #include "win32/Win32Window.h"
#include <sstream>
Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags) Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags)
{ {
switch (key) switch (key)
...@@ -377,8 +379,14 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh ...@@ -377,8 +379,14 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh
{ {
destroy(); destroy();
mParentClassName = name; // Use a new window class name for ever window to ensure that a new window can be created
mChildClassName = name + "Child"; // even if the last one was not properly destroyed
static size_t windowIdx = 0;
std::ostringstream nameStream;
nameStream << name << "_" << windowIdx++;
mParentClassName = nameStream.str();
mChildClassName = mParentClassName + "_Child";
// Work around compile error from not defining "UNICODE" while Chromium does // Work around compile error from not defining "UNICODE" while Chromium does
const LPSTR idcArrow = MAKEINTRESOURCEA(32512); const LPSTR idcArrow = MAKEINTRESOURCEA(32512);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment