Init Python before RCore

This commit is contained in:
Florian Märkl 2019-02-20 18:52:11 +01:00
parent a93c5e225f
commit d1f5da9946
5 changed files with 19 additions and 19 deletions

View File

@ -12,7 +12,7 @@
#include "Cutter.h" #include "Cutter.h"
#include "sdb.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) #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) : CutterCore::CutterCore(QObject *parent) :
QObject(parent) QObject(parent)
{
}
CutterCore *CutterCore::instance()
{
return uniqueInstance;
}
void CutterCore::initialize()
{ {
r_cons_new(); // initialize console r_cons_new(); // initialize console
core_ = r_core_new(); core_ = r_core_new();
@ -174,12 +184,6 @@ CutterCore::CutterCore(QObject *parent) :
asyncTaskManager = new AsyncTaskManager(this); asyncTaskManager = new AsyncTaskManager(this);
} }
CutterCore *CutterCore::instance()
{
return uniqueInstance;
}
QList<QString> CutterCore::sdbList(QString path) QList<QString> CutterCore::sdbList(QString path)
{ {
CORE_LOCK(); CORE_LOCK();

View File

@ -412,13 +412,14 @@ Q_DECLARE_METATYPE(VariableDescription)
class CutterCore: public QObject class CutterCore: public QObject
{ {
Q_OBJECT Q_OBJECT
friend class ccClass;
public: public:
explicit CutterCore(QObject *parent = nullptr); explicit CutterCore(QObject *parent = nullptr);
~CutterCore(); ~CutterCore();
static CutterCore *instance(); static CutterCore *instance();
void initialize();
AsyncTaskManager *getAsyncTaskManager() { return asyncTaskManager; } AsyncTaskManager *getAsyncTaskManager() { return asyncTaskManager; }
RVA getOffset() const { return core_->offset; } RVA getOffset() const { return core_->offset; }
@ -779,7 +780,7 @@ private:
MemoryWidgetType memoryWidgetPriority; MemoryWidgetType memoryWidgetPriority;
QString notes; QString notes;
RCore *core_; RCore *core_ = nullptr;
AsyncTaskManager *asyncTaskManager; AsyncTaskManager *asyncTaskManager;
RVA offsetPriorDebugging = RVA_INVALID; RVA offsetPriorDebugging = RVA_INVALID;
QErrorMessage msgBox; QErrorMessage msgBox;
@ -789,8 +790,4 @@ private:
}; };
class ccClass : public CutterCore
{
};
#endif // CUTTER_H #endif // CUTTER_H

View File

@ -104,13 +104,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
Python()->initialize(); Python()->initialize();
#endif #endif
Core()->initialize();
Core()->setSettings();
Config()->loadInitial();
bool analLevelSpecified = false; bool analLevelSpecified = false;
int analLevel = 0; int analLevel = 0;
// Initialize CutterCore and set default settings
Core()->setSettings();
if (cmd_parser.isSet(analOption)) { if (cmd_parser.isSet(analOption)) {
analLevel = cmd_parser.value(analOption).toInt(&analLevelSpecified); analLevel = cmd_parser.value(analOption).toInt(&analLevelSpecified);

View File

@ -64,7 +64,6 @@ Configuration::Configuration() : QObject()
.arg(s.fileName()) .arg(s.fileName())
); );
} }
loadInitial();
} }
Configuration *Configuration::instance() Configuration *Configuration::instance()

View File

@ -27,8 +27,6 @@ private:
QSettings s; QSettings s;
static Configuration *mPtr; static Configuration *mPtr;
void loadInitial();
// Colors // Colors
void loadBaseThemeNative(); void loadBaseThemeNative();
void loadBaseThemeDark(); void loadBaseThemeDark();
@ -44,6 +42,8 @@ public:
Configuration(); Configuration();
static Configuration *instance(); static Configuration *instance();
void loadInitial();
void resetAll(); void resetAll();
// Languages // Languages