Skip to content

Commit

Permalink
fix: properly destroy profile and exiftool process on close (fix #3231)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Jul 1, 2024
1 parent f95c659 commit 80bb6ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/cli/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <QCoreApplication>
#include <QMap>
#include <QScopedPointer>
#include <QSettings>
#include <QString>
#include <QStringList>
Expand All @@ -20,10 +21,10 @@ int main(int argc, char *argv[])

Logger::getInstance().initialize();

auto *profile = new Profile(savePath());
profile->purgeTemp(24 * 60 * 60);
Profile profile(savePath());
profile.purgeTemp(24 * 60 * 60);

QMap<QString, QString> params;
QStringList positionalArgs;
return parseAndRunCliArgs(&app, profile, false, params, positionalArgs);
return parseAndRunCliArgs(&app, &profile, false, params, positionalArgs);
}
10 changes: 5 additions & 5 deletions src/gui/src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ int main(int argc, char *argv[])
// Ensure SSL libraries are loaded
QSslSocket::supportsSsl();

auto *profile = new Profile(savePath());
profile->purgeTemp(24 * 60 * 60);
QSettings *settings = profile->getSettings();
Profile profile(savePath());
profile.purgeTemp(24 * 60 * 60);
QSettings *settings = profile.getSettings();

// Default to the GUI unless USE_CLI is defined
bool defaultToGui = true;
Expand All @@ -139,7 +139,7 @@ int main(int argc, char *argv[])
// Parse CLI parameters
QMap<QString, QString> params;
QStringList positionalArgs;
const int ret = parseAndRunCliArgs(&app, profile, defaultToGui, params, positionalArgs);
const int ret = parseAndRunCliArgs(&app, &profile, defaultToGui, params, positionalArgs);
if (ret != -1) {
return ret;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ int main(int argc, char *argv[])
}

// Run the main window
auto *mainWindow = new MainWindow(profile);
auto *mainWindow = new MainWindow(&profile);
mainWindow->init(positionalArgs, params);
mainWindow->show();

Expand Down

0 comments on commit 80bb6ab

Please sign in to comment.