Skip to content

Commit

Permalink
fix(AppManager): Don't create temporary copy of argc
Browse files Browse the repository at this point in the history
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 qTox#6641
  • Loading branch information
anthonybilinski committed Jun 14, 2022
1 parent b394f22 commit 2197bce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/appmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/appmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AppManager : public QObject
Q_OBJECT

public:
AppManager(int argc, char** argv);
AppManager(int& argc, char** argv);
~AppManager();
int run();

Expand Down

0 comments on commit 2197bce

Please sign in to comment.