Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

終了時に mutex のエラーでクラッシュすることがある(Windows 版) #1033

Closed
Reputeless opened this issue Jul 26, 2023 · 0 comments

Comments

@Reputeless
Copy link
Member

エンジン終了時、キーボードコンポーネントがウィンドウコンポーネントより先に破棄されるが、ウィンドウコンポーネントの破棄途中で

case WM_KEYDOWN:
{
LOG_VERBOSE(U"WM_KEYDOWN");
const bool repeatFlag = ((HIWORD(lParam) & KF_REPEAT) == KF_REPEAT);
if (not repeatFlag)
{
static_cast<CKeyboard*>(SIV3D_ENGINE(Keyboard))->onKeyEvent(static_cast<uint8>(wParam), true, false);
}
break;
}
case WM_KEYUP:
{
static_cast<CKeyboard*>(SIV3D_ENGINE(Keyboard))->onKeyEvent(static_cast<uint8>(wParam), false, true);
break;
}

void CKeyboard::onKeyEvent(const uint8 code, const bool down, const bool up)
{
std::lock_guard lock{ m_eventMutex };
m_events.emplace_back(Time::GetMillisec(), ++m_eventIndex, code, down, up);
}

が呼ばれることがあるため。

キーボード以外のコンポーネントの使用も起こらないよう対策する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant