diff --git a/src/Cutter.cpp b/src/Cutter.cpp index 634a38cf..cf9a7520 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -12,7 +12,7 @@ #include "Cutter.h" #include "sdb.h" -Q_GLOBAL_STATIC(ccClass, uniqueInstance) +Q_GLOBAL_STATIC(CutterCore, uniqueInstance) #define R_JSON_KEY(name) static const QString name = QStringLiteral(#name) @@ -139,6 +139,16 @@ static void cutterREventCallback(REvent *, int type, void *user, void *data) CutterCore::CutterCore(QObject *parent) : QObject(parent) +{ +} + + +CutterCore *CutterCore::instance() +{ + return uniqueInstance; +} + +void CutterCore::initialize() { r_cons_new(); // initialize console core_ = r_core_new(); @@ -174,12 +184,6 @@ CutterCore::CutterCore(QObject *parent) : asyncTaskManager = new AsyncTaskManager(this); } - -CutterCore *CutterCore::instance() -{ - return uniqueInstance; -} - QList CutterCore::sdbList(QString path) { CORE_LOCK(); diff --git a/src/Cutter.h b/src/Cutter.h index ae7f4fae..43e5b5ee 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -412,13 +412,14 @@ Q_DECLARE_METATYPE(VariableDescription) class CutterCore: public QObject { Q_OBJECT - friend class ccClass; public: explicit CutterCore(QObject *parent = nullptr); ~CutterCore(); static CutterCore *instance(); + void initialize(); + AsyncTaskManager *getAsyncTaskManager() { return asyncTaskManager; } RVA getOffset() const { return core_->offset; } @@ -779,7 +780,7 @@ private: MemoryWidgetType memoryWidgetPriority; QString notes; - RCore *core_; + RCore *core_ = nullptr; AsyncTaskManager *asyncTaskManager; RVA offsetPriorDebugging = RVA_INVALID; QErrorMessage msgBox; @@ -789,8 +790,4 @@ private: }; -class ccClass : public CutterCore -{ -}; - #endif // CUTTER_H diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index 52ed7acd..50298c17 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -104,13 +104,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc Python()->initialize(); #endif + Core()->initialize(); + Core()->setSettings(); + Config()->loadInitial(); bool analLevelSpecified = false; int analLevel = 0; - // Initialize CutterCore and set default settings - Core()->setSettings(); - if (cmd_parser.isSet(analOption)) { analLevel = cmd_parser.value(analOption).toInt(&analLevelSpecified); diff --git a/src/common/Configuration.cpp b/src/common/Configuration.cpp index cc4e2a19..902e4f80 100644 --- a/src/common/Configuration.cpp +++ b/src/common/Configuration.cpp @@ -64,7 +64,6 @@ Configuration::Configuration() : QObject() .arg(s.fileName()) ); } - loadInitial(); } Configuration *Configuration::instance() diff --git a/src/common/Configuration.h b/src/common/Configuration.h index 86857fe7..4635ea95 100644 --- a/src/common/Configuration.h +++ b/src/common/Configuration.h @@ -27,8 +27,6 @@ private: QSettings s; static Configuration *mPtr; - void loadInitial(); - // Colors void loadBaseThemeNative(); void loadBaseThemeDark(); @@ -44,6 +42,8 @@ public: Configuration(); static Configuration *instance(); + void loadInitial(); + void resetAll(); // Languages