Fixed a number of potential issues where SDL_Event unions were not properly initialized

This commit is contained in:
Leon Styhre 2024-01-05 10:42:28 +01:00
parent 9cd35bed3d
commit 6bad84a27a
5 changed files with 9 additions and 10 deletions

View file

@ -162,7 +162,7 @@ void ViewController::migratedAppDataFilesDialog()
mWindow->pushGui(new GuiMsgBox(
HelpStyle(), message.c_str(), "QUIT",
[] {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
},
@ -201,7 +201,7 @@ void ViewController::invalidSystemsFileDialog()
mWindow->pushGui(new GuiMsgBox(
HelpStyle(), errorMessage.c_str(), "QUIT",
[] {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
},
@ -318,7 +318,7 @@ void ViewController::noGamesDialog()
},
"QUIT",
[] {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
},
@ -1462,7 +1462,7 @@ void ViewController::rescanROMDirectory()
SystemData::loadConfig();
if (SystemData::sStartupExitSignal) {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return;
@ -1477,7 +1477,7 @@ void ViewController::rescanROMDirectory()
else {
preload();
if (SystemData::sStartupExitSignal) {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return;

View file

@ -48,7 +48,7 @@ static void onKeyPress(void* /*cbParam*/, const CEC::cec_keypress* key)
{
LOG(LogDebug) << "CECInput::onKeyPress keycode: " << CECInput::getKeyCodeString(key->keycode);
SDL_Event event;
SDL_Event event {};
event.type = (key->duration > 0) ? SDL_USER_CECBUTTONUP : SDL_USER_CECBUTTONDOWN;
event.user.code = key->keycode;
SDL_PushEvent(&event);

View file

@ -454,7 +454,7 @@ bool InputManager::parseEvent(const SDL_Event& event)
#if defined(__ANDROID__)
// Quit application if the back button is pressed.
if (event.key.keysym.sym == SDLK_AC_BACK) {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return false;
@ -490,7 +490,7 @@ bool InputManager::parseEvent(const SDL_Event& event)
quitES = true;
if (quitES) {
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return false;

View file

@ -22,7 +22,6 @@
class InputConfig;
class Window;
union SDL_Event;
class InputManager
{

View file

@ -330,7 +330,7 @@ namespace Utils
{
sQuitMode = mode;
SDL_Event quit;
SDL_Event quit {};
quit.type = SDL_QUIT;
SDL_PushEvent(&quit);
return 0;