mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 10:43:33 +00:00
Fix infinite recursion in UpdateUITheme() on Arch Linux
Add recursion guard (m_is_updating_theme) to prevent UpdateUITheme() from entering an infinite loop when palette changes trigger recursive theme updates. This eliminates the need for manual qt-config.ini edits on Arch Linux systems. The guard ensures that if UpdateUITheme() is already running, subsequent calls will exit immediately, preventing stack overflow and application freezing. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -5791,6 +5791,14 @@ static void AdjustLinkColor() {
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateUITheme() {
|
||||
// If the function is already running, exit immediately to prevent recursion.
|
||||
if (m_is_updating_theme) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the flag to true to indicate that a theme update is in progress.
|
||||
m_is_updating_theme = true;
|
||||
|
||||
QString current_theme = QString::fromStdString(UISettings::values.theme);
|
||||
const QString default_theme_name = QString::fromUtf8(
|
||||
UISettings::themes[static_cast<size_t>(UISettings::default_theme)].second);
|
||||
@@ -5844,6 +5852,9 @@ void GMainWindow::UpdateUITheme() {
|
||||
}
|
||||
|
||||
emit themeChanged();
|
||||
|
||||
// Once everything is done, reset the flag to false.
|
||||
m_is_updating_theme = false;
|
||||
}
|
||||
|
||||
void GMainWindow::LoadTranslation() {
|
||||
|
||||
@@ -393,6 +393,7 @@ private:
|
||||
bool is_amiibo_file_select_active{};
|
||||
bool is_load_file_select_active{};
|
||||
bool is_tas_recording_dialog_active{};
|
||||
bool m_is_updating_theme = false;
|
||||
#ifdef __unix__
|
||||
QSocketNotifier* sig_interrupt_notifier;
|
||||
static std::array<int, 3> sig_interrupt_fds;
|
||||
|
||||
Reference in New Issue
Block a user