1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Replaced SDL user events list with dispatching of arbitrary functors

This commit is contained in:
Ivan Savenko
2023-06-26 21:51:10 +03:00
parent 7fc66c2797
commit 0f8d53e978
15 changed files with 176 additions and 177 deletions

View File

@ -68,7 +68,10 @@ ISelectionScreenInfo * SEL;
static void do_quit()
{
GH.pushUserEvent(EUserEvent::FORCE_QUIT);
GH.dispatchMainThread([]()
{
handleQuit(false);
});
}
CMenuScreen::CMenuScreen(const JsonNode & configNode)
@ -562,10 +565,13 @@ void CSimpleJoinScreen::connectThread(const std::string & addr, ui16 port)
else
CSH->justConnectToServer(addr, port);
if(GH.windows().isTopWindow(this))
{
close();
}
// async call to prevent thread race
GH.dispatchMainThread([this](){
if(GH.windows().isTopWindow(this))
{
close();
}
});
}
CLoadingScreen::CLoadingScreen(std::function<void()> loader)