Only show assertion popup for assertions on main thread

The SDL function may only be called from the main thread, so we can't show a popup for failed assertions on other threads.
This commit is contained in:
Robert Müller 2023-05-07 19:21:43 +02:00
parent 262a2a83a6
commit 817d96a73d

View file

@ -4589,7 +4589,10 @@ int main(int argc, const char **argv)
pKernel->RegisterInterface(pClient, false);
pClient->RegisterInterfaces();
dbg_assert_set_handler([pClient](const char *pMsg) {
const std::thread::id MainThreadId = std::this_thread::get_id();
dbg_assert_set_handler([MainThreadId, pClient](const char *pMsg) {
if(MainThreadId != std::this_thread::get_id())
return;
char aVersionStr[128];
if(os_version_str(aVersionStr, sizeof(aVersionStr)))
str_copy(aVersionStr, "unknown");