From e080164305730792f2f7230c4d8bf305f1e2f2a1 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 11 Dec 2023 23:05:47 +0100 Subject: [PATCH] fix: Restart imhex popup not working correctly --- plugins/builtin/include/content/views/view_settings.hpp | 1 + plugins/builtin/source/content/views/view_settings.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/include/content/views/view_settings.hpp b/plugins/builtin/include/content/views/view_settings.hpp index a7095786a..1c0945580 100644 --- a/plugins/builtin/include/content/views/view_settings.hpp +++ b/plugins/builtin/include/content/views/view_settings.hpp @@ -20,6 +20,7 @@ namespace hex::plugin::builtin { private: bool m_restartRequested = false; + bool m_triggerPopup = false; }; } \ No newline at end of file diff --git a/plugins/builtin/source/content/views/view_settings.cpp b/plugins/builtin/source/content/views/view_settings.cpp index 6438af085..7cb860507 100644 --- a/plugins/builtin/source/content/views/view_settings.cpp +++ b/plugins/builtin/source/content/views/view_settings.cpp @@ -87,8 +87,10 @@ namespace hex::plugin::builtin { widget->onChanged(); // Request a restart if the setting requires it - if (widget->doesRequireRestart()) + if (widget->doesRequireRestart()) { this->m_restartRequested = true; + this->m_triggerPopup = true; + } } } } @@ -107,7 +109,8 @@ namespace hex::plugin::builtin { void ViewSettings::drawAlwaysVisibleContent() { // If a restart is required, ask the user if they want to restart - if (!this->getWindowOpenState() && this->m_restartRequested) { + if (!this->getWindowOpenState() && this->m_triggerPopup) { + this->m_triggerPopup = false; PopupQuestion::open("hex.builtin.view.settings.restart_question"_lang, ImHexApi::System::restartImHex, [this]{