Fix double initialization on theme change

This commit is contained in:
woblight
2025-01-29 19:15:30 +01:00
parent c98a505fbc
commit ed8efc303a
3 changed files with 7 additions and 1 deletions
+3
View File
@@ -49,6 +49,8 @@ Control::Control(QObject *parent) : QObject(parent),
}
void Control::init() {
if (m_initDone)
return;
git_libgit2_init();
QSettings settings;
if (settings.value("addonsPaths").isNull()) {
@@ -67,6 +69,7 @@ void Control::init() {
connect(this, &Control::addonsPathsChanged, this, &Control::saveAddonsPaths);
connect(this, &Control::useRepoDirectoryChanged, this, &Control::saveUseRepoDirectory);
m_initDone = true;
}
QStringList Control::addonsPaths() const
+1
View File
@@ -65,6 +65,7 @@ class Control : public QObject
QList<Addon *> m_addons;
bool m_lock = false;
bool m_initDone = false;
public:
Q_PROPERTY(QString version READ version CONSTANT)
+3 -1
View File
@@ -47,6 +47,8 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
qSetMessagePattern("[%{time yyyyMMdd h:mm:ss.zzz t} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{message}");
// make sure Control is not instantiated in the logger thread
Control::instance();
originalHandler = qInstallMessageHandler(&logger);
QCommandLineParser parser;
@@ -90,7 +92,7 @@ int main(int argc, char *argv[])
qmlRegisterUncreatableType<Addon>("GitAddonsManager.engine",1,0,"Addon","");
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (parser.isSet("oneshot")) {
QMetaObject::invokeMethod(Control::instance(), &Control::updateAllAndClose, Qt::QueuedConnection);
Control::instance()->updateAllAndClose();
}
}