Fix double initialization on theme change
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user