From 165ad96be1d19aa6b00e4fa4cecdc33bd879f40b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 18 Nov 2018 22:04:44 -0800 Subject: [PATCH] Fix stack overflow if SDL gamepad initialization fails --- app/gui/main.qml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/gui/main.qml b/app/gui/main.qml index c1330708..df1367cc 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -137,6 +137,11 @@ ApplicationWindow { // Doing it earlier can lead to the dialog appearing behind // the window or otherwise without input focus. if (!initialized) { + // Set initialized before calling anything else, because + // pumping the event loop can cause us to get another + // onAfterRendering call and potentially reenter this code. + initialized = true; + if (prefs.isRunningWayland()) { waylandDialog.open() } @@ -152,8 +157,6 @@ ApplicationWindow { unmappedGamepadDialog.unmappedGamepads = unmappedGamepads unmappedGamepadDialog.open() } - - initialized = true; } }