Use helper functions to construct smart pointers

This commit is contained in:
Chocobo1 2020-03-05 00:39:41 +08:00
parent ca01b049a6
commit 2157e500ef
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
7 changed files with 10 additions and 10 deletions

View file

@ -136,7 +136,7 @@ int main(int argc, char *argv[])
try {
// Create Application
const QString appId = QLatin1String("qBittorrent-") + Utils::Misc::getUserIDString();
std::unique_ptr<Application> app(new Application(appId, argc, argv));
auto app = std::make_unique<Application>(appId, argc, argv);
const QBtCommandLineParameters params = app->commandLineArgs();
@ -258,7 +258,7 @@ int main(int argc, char *argv[])
if (params.shouldDaemonize) {
app.reset(); // Destroy current application
if (daemon(1, 0) == 0) {
app.reset(new Application(appId, argc, argv));
app = std::make_unique<Application>(appId, argc, argv);
if (app->isRunning()) {
// Another instance had time to start.
return EXIT_FAILURE;