From cefb781184defb36c89bc7605a178f9dc0206041 Mon Sep 17 00:00:00 2001 From: Zephyron Date: Sun, 21 Sep 2025 15:49:19 +1000 Subject: [PATCH] Fix UpdaterService class redefinition conflict The MOC compiler was encountering two different definitions of UpdaterService: 1. A stub class in updater_dialog.h for non-Windows platforms 2. The real QObject-derived class in updater_service.h Fixed by: - Making updater_service.h include conditional in main.cpp (#ifdef _WIN32) - Wrapping all UpdaterService usage in main.cpp with #ifdef _WIN32 blocks - Adding clarifying comment to stub class in updater_dialog.h This resolves the MOC compilation errors and ensures the updater functionality is only available on Windows as intended. --- src/citron/main.cpp | 6 +++++- src/citron/updater/updater_dialog.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/citron/main.cpp b/src/citron/main.cpp index a8411ab43..4b41dc92c 100644 --- a/src/citron/main.cpp +++ b/src/citron/main.cpp @@ -166,8 +166,8 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include "citron/uisettings.h" #ifdef _WIN32 #include "citron/updater/updater_dialog.h" -#endif #include "citron/updater/updater_service.h" +#endif #include "citron/util/clickable_label.h" #include "citron/util/performance_overlay.h" #include "citron/util/vram_overlay.h" @@ -5522,6 +5522,7 @@ int main(int argc, char* argv[]) { QApplication app(argc, argv); +#ifdef _WIN32 // Check for and apply staged updates before starting the main application std::filesystem::path app_dir = std::filesystem::path(QCoreApplication::applicationDirPath().toStdString()); if (Updater::UpdaterService::HasStagedUpdate(app_dir)) { @@ -5531,6 +5532,7 @@ int main(int argc, char* argv[]) { QObject::tr("Citron has been updated successfully!")); } } +#endif #ifdef _WIN32 OverrideWindowsFont(); @@ -5581,6 +5583,7 @@ void GMainWindow::OnCheckForUpdates() { } void GMainWindow::CheckForUpdatesAutomatically() { +#ifdef _WIN32 // Check if automatic updates are enabled if (!Settings::values.enable_auto_update_check.GetValue()) { return; @@ -5620,6 +5623,7 @@ void GMainWindow::CheckForUpdatesAutomatically() { // Start the silent update check updater_service->CheckForUpdates(update_url); +#endif } void GMainWindow::OnToggleGridView() { diff --git a/src/citron/updater/updater_dialog.h b/src/citron/updater/updater_dialog.h index 6a3edde19..3b6776868 100644 --- a/src/citron/updater/updater_dialog.h +++ b/src/citron/updater/updater_dialog.h @@ -18,6 +18,7 @@ // Forward declarations for non-Windows platforms namespace Updater { struct UpdateInfo; +// Stub class for non-Windows platforms - not a QObject class UpdaterService { public: enum class UpdateResult {