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( mWindow->pushGui(new GuiMsgBox(
HelpStyle(), message.c_str(), "QUIT", HelpStyle(), message.c_str(), "QUIT",
[] { [] {
SDL_Event quit; SDL_Event quit {};
quit.type = SDL_QUIT; quit.type = SDL_QUIT;
SDL_PushEvent(&quit); SDL_PushEvent(&quit);
}, },
@ -201,7 +201,7 @@ void ViewController::invalidSystemsFileDialog()
mWindow->pushGui(new GuiMsgBox( mWindow->pushGui(new GuiMsgBox(
HelpStyle(), errorMessage.c_str(), "QUIT", HelpStyle(), errorMessage.c_str(), "QUIT",
[] { [] {
SDL_Event quit; SDL_Event quit {};
quit.type = SDL_QUIT; quit.type = SDL_QUIT;
SDL_PushEvent(&quit); SDL_PushEvent(&quit);
}, },
@ -318,7 +318,7 @@ void ViewController::noGamesDialog()
}, },
"QUIT", "QUIT",
[] { [] {
SDL_Event quit; SDL_Event quit {};
quit.type = SDL_QUIT; quit.type = SDL_QUIT;
SDL_PushEvent(&quit); SDL_PushEvent(&quit);
}, },
@ -1462,7 +1462,7 @@ void ViewController::rescanROMDirectory()
SystemData::loadConfig(); SystemData::loadConfig();
if (SystemData::sStartupExitSignal) { if (SystemData::sStartupExitSignal) {
SDL_Event quit; SDL_Event quit {};
quit.type = SDL_QUIT; quit.type = SDL_QUIT;
SDL_PushEvent(&quit); SDL_PushEvent(&quit);
return; return;
@ -1477,7 +1477,7 @@ void ViewController::rescanROMDirectory()
else { else {
preload(); preload();
if (SystemData::sStartupExitSignal) { if (SystemData::sStartupExitSignal) {
SDL_Event quit; SDL_Event quit {};
quit.type = SDL_QUIT; quit.type = SDL_QUIT;
SDL_PushEvent(&quit); SDL_PushEvent(&quit);
return; 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); 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.type = (key->duration > 0) ? SDL_USER_CECBUTTONUP : SDL_USER_CECBUTTONDOWN;
event.user.code = key->keycode; event.user.code = key->keycode;
SDL_PushEvent(&event); SDL_PushEvent(&event);

View file

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

View file

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

View file

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