1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00

Fix more leaked memory due to QObject parents not being set

This commit is contained in:
Joshua Goins 2022-07-21 21:38:26 -04:00
parent da99c09706
commit 66f65784a8
8 changed files with 9 additions and 16 deletions

View file

@ -126,7 +126,6 @@ class LauncherCore : public QObject {
Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot)
public:
LauncherCore();
~LauncherCore();
// used for qml only, TODO: move this to a dedicated factory
Q_INVOKABLE LoginInformation* createNewLoginInfo() {

View file

@ -13,7 +13,7 @@
class Watchdog : public QObject {
Q_OBJECT
public:
Watchdog(LauncherCore& core) : core(core) {}
Watchdog(LauncherCore& core) : core(core), QObject(&core) {}
void launchGame(const ProfileSettings& settings, LoginAuth auth);

View file

@ -479,7 +479,7 @@ void LauncherCore::readWineInfo(ProfileSettings& profile) {
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
auto wineProcess = new QProcess();
auto wineProcess = new QProcess(this);
wineProcess->setProcessChannelMode(QProcess::MergedChannels);
connect(wineProcess, &QProcess::readyRead, this, [wineProcess, &profile] {
@ -543,12 +543,6 @@ LauncherCore::LauncherCore() : settings(QSettings::IniFormat, QSettings::UserSco
readInitialInformation();
}
LauncherCore::~LauncherCore() noexcept {
#ifdef ENABLE_WATCHDOG
delete watchdog;
#endif
}
ProfileSettings& LauncherCore::getProfile(int index) {
return *profileSettings[index];
}

View file

@ -5,7 +5,7 @@
#include <QMessageBox>
#include <QNetworkReply>
SapphireLauncher::SapphireLauncher(LauncherCore& window) : window(window) {
SapphireLauncher::SapphireLauncher(LauncherCore& window) : window(window), QObject(&window) {
}

View file

@ -12,7 +12,7 @@
#include "squarelauncher.h"
SquareBoot::SquareBoot(LauncherCore& window, SquareLauncher& launcher) : window(window), launcher(launcher) {
SquareBoot::SquareBoot(LauncherCore& window, SquareLauncher& launcher) : window(window), launcher(launcher), QObject(&window) {
}

View file

@ -16,7 +16,7 @@
#include "watchdog.h"
#endif
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window) {
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window), QObject(&window) {
}

View file

@ -37,7 +37,7 @@ QMap<DalamudChannel, QString> channelToDistribPrefix = {
{DalamudChannel::Net5, "net5/"}
};
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) {
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher), QObject(&launcher) {
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
dataDir =

View file

@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
QCommandLineOption cliOption("cli", "Don't open a main window, and use the cli interface.");
parser.addOption(cliOption);
auto cmd = new CMDInterface(parser);
auto cmd = std::make_unique<CMDInterface>(parser);
parser.process(app);
@ -63,12 +63,12 @@ int main(int argc, char* argv[]) {
LauncherCore c;
if(parser.isSet(tabletOption)) {
new TabletInterface(c);
std::make_unique<TabletInterface>(c);
} else if(parser.isSet(cliOption)) {
if(!cmd->parse(parser, c))
return -1;
} else {
new DesktopInterface(c);
std::make_unique<DesktopInterface>(c);
}
return app.exec();