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:
parent
da99c09706
commit
66f65784a8
8 changed files with 9 additions and 16 deletions
|
@ -126,7 +126,6 @@ class LauncherCore : public QObject {
|
||||||
Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot)
|
Q_PROPERTY(SquareBoot* squareBoot MEMBER squareBoot)
|
||||||
public:
|
public:
|
||||||
LauncherCore();
|
LauncherCore();
|
||||||
~LauncherCore();
|
|
||||||
|
|
||||||
// used for qml only, TODO: move this to a dedicated factory
|
// used for qml only, TODO: move this to a dedicated factory
|
||||||
Q_INVOKABLE LoginInformation* createNewLoginInfo() {
|
Q_INVOKABLE LoginInformation* createNewLoginInfo() {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
class Watchdog : public QObject {
|
class Watchdog : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Watchdog(LauncherCore& core) : core(core) {}
|
Watchdog(LauncherCore& core) : core(core), QObject(&core) {}
|
||||||
|
|
||||||
void launchGame(const ProfileSettings& settings, LoginAuth auth);
|
void launchGame(const ProfileSettings& settings, LoginAuth auth);
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,7 @@ void LauncherCore::readWineInfo(ProfileSettings& profile) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
|
||||||
auto wineProcess = new QProcess();
|
auto wineProcess = new QProcess(this);
|
||||||
wineProcess->setProcessChannelMode(QProcess::MergedChannels);
|
wineProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
|
||||||
connect(wineProcess, &QProcess::readyRead, this, [wineProcess, &profile] {
|
connect(wineProcess, &QProcess::readyRead, this, [wineProcess, &profile] {
|
||||||
|
@ -543,12 +543,6 @@ LauncherCore::LauncherCore() : settings(QSettings::IniFormat, QSettings::UserSco
|
||||||
readInitialInformation();
|
readInitialInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
LauncherCore::~LauncherCore() noexcept {
|
|
||||||
#ifdef ENABLE_WATCHDOG
|
|
||||||
delete watchdog;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
ProfileSettings& LauncherCore::getProfile(int index) {
|
ProfileSettings& LauncherCore::getProfile(int index) {
|
||||||
return *profileSettings[index];
|
return *profileSettings[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
|
||||||
SapphireLauncher::SapphireLauncher(LauncherCore& window) : window(window) {
|
SapphireLauncher::SapphireLauncher(LauncherCore& window) : window(window), QObject(&window) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "squarelauncher.h"
|
#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) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window) {
|
SquareLauncher::SquareLauncher(LauncherCore& window) : window(window), QObject(&window) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ QMap<DalamudChannel, QString> channelToDistribPrefix = {
|
||||||
{DalamudChannel::Net5, "net5/"}
|
{DalamudChannel::Net5, "net5/"}
|
||||||
};
|
};
|
||||||
|
|
||||||
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher) {
|
AssetUpdater::AssetUpdater(LauncherCore& launcher) : launcher(launcher), QObject(&launcher) {
|
||||||
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
launcher.mgr->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
|
||||||
dataDir =
|
dataDir =
|
||||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char* argv[]) {
|
||||||
QCommandLineOption cliOption("cli", "Don't open a main window, and use the cli interface.");
|
QCommandLineOption cliOption("cli", "Don't open a main window, and use the cli interface.");
|
||||||
parser.addOption(cliOption);
|
parser.addOption(cliOption);
|
||||||
|
|
||||||
auto cmd = new CMDInterface(parser);
|
auto cmd = std::make_unique<CMDInterface>(parser);
|
||||||
|
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
|
|
||||||
|
@ -63,12 +63,12 @@ int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
LauncherCore c;
|
LauncherCore c;
|
||||||
if(parser.isSet(tabletOption)) {
|
if(parser.isSet(tabletOption)) {
|
||||||
new TabletInterface(c);
|
std::make_unique<TabletInterface>(c);
|
||||||
} else if(parser.isSet(cliOption)) {
|
} else if(parser.isSet(cliOption)) {
|
||||||
if(!cmd->parse(parser, c))
|
if(!cmd->parse(parser, c))
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
new DesktopInterface(c);
|
std::make_unique<DesktopInterface>(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|
Loading…
Add table
Reference in a new issue