From 2197bce610f2abf5e561b1ee528313660b0f0fb9 Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Tue, 14 Jun 2022 16:23:50 -0700 Subject: [PATCH] fix(AppManager): Don't create temporary copy of argc QApplication takes argc by reference, so copying it in to AppManager's constructor causes QApplication's to have an invalid reference once AppManager's constructor returns. Instead just reference main's argc. Fix #6641 --- src/appmanager.cpp | 2 +- src/appmanager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/appmanager.cpp b/src/appmanager.cpp index 1e16a2e12..dafc11c3d 100644 --- a/src/appmanager.cpp +++ b/src/appmanager.cpp @@ -162,7 +162,7 @@ bool toxURIEventHandler(const QByteArray& eventData, void* userData) } } // namespace -AppManager::AppManager(int argc, char** argv) +AppManager::AppManager(int& argc, char** argv) : qapp((preConstructionInitialization(), new QApplication(argc, argv))) , messageBoxManager(new MessageBoxManager(nullptr)) , settings(new Settings(*messageBoxManager)) diff --git a/src/appmanager.h b/src/appmanager.h index 5deed3011..0eb50d39c 100644 --- a/src/appmanager.h +++ b/src/appmanager.h @@ -36,7 +36,7 @@ class AppManager : public QObject Q_OBJECT public: - AppManager(int argc, char** argv); + AppManager(int& argc, char** argv); ~AppManager(); int run();