Merge pull request #12083 from glassez/app-instances

Allow single app instance per configuration
This commit is contained in:
Vladimir Golovnev 2020-03-09 07:40:48 +03:00 committed by GitHub
commit a7b342edcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 14 deletions

View file

@ -78,7 +78,6 @@ Q_IMPORT_PLUGIN(QICOPlugin)
#include "base/preferences.h"
#include "base/profile.h"
#include "base/utils/misc.h"
#include "application.h"
#include "cmdoptions.h"
#include "upgrade.h"
@ -141,11 +140,9 @@ int main(int argc, char *argv[])
try {
// Create Application
const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
auto app = std::make_unique<Application>(appId, argc, argv);
auto app = std::make_unique<Application>(argc, argv);
const QBtCommandLineParameters params = app->commandLineArgs();
if (!params.unknownParameter.isEmpty()) {
throw CommandLineParameterError(QObject::tr("%1 is an unknown command line parameter.",
"--random-parameter is an unknown command line parameter.")
@ -264,7 +261,7 @@ int main(int argc, char *argv[])
if (params.shouldDaemonize) {
app.reset(); // Destroy current application
if (daemon(1, 0) == 0) {
app = std::make_unique<Application>(appId, argc, argv);
app = std::make_unique<Application>(argc, argv);
if (app->isRunning()) {
// Another instance had time to start.
return EXIT_FAILURE;