refactor: On windows use the old malloc method to prevent random test failure in IKeyState
This commit is contained in:
committed by
Chris Rizzitello
parent
d6b53ea718
commit
8d92a8df68
@ -44,7 +44,13 @@ IKeyState::KeyInfo *IKeyState::KeyInfo::alloc(
|
||||
const char *buffer = screens.c_str();
|
||||
|
||||
// build structure
|
||||
#if SYSAPI_WIN32
|
||||
// On windows we use malloc to avoid random test failures
|
||||
auto *info = (KeyInfo *)malloc(sizeof(KeyInfo) + screens.size());
|
||||
#else
|
||||
auto *info = new KeyInfo();
|
||||
#endif
|
||||
|
||||
info->m_key = id;
|
||||
info->m_mask = mask;
|
||||
info->m_button = button;
|
||||
@ -57,7 +63,14 @@ IKeyState::KeyInfo *IKeyState::KeyInfo::alloc(
|
||||
IKeyState::KeyInfo *IKeyState::KeyInfo::alloc(const KeyInfo &x)
|
||||
{
|
||||
auto bufferLen = strnlen(x.m_screensBuffer, SIZE_MAX);
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
// On windows we use malloc to avoid random test failures
|
||||
auto info = (KeyInfo *)malloc(sizeof(KeyInfo) + bufferLen);
|
||||
#else
|
||||
auto *info = new KeyInfo();
|
||||
#endif
|
||||
|
||||
info->m_key = x.m_key;
|
||||
info->m_mask = x.m_mask;
|
||||
info->m_button = x.m_button;
|
||||
|
||||
Reference in New Issue
Block a user