mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +00:00
Partially fix shutting down Python
This commit is contained in:
parent
da3e1fad29
commit
1c98a1c42e
@ -170,8 +170,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
|||||||
|
|
||||||
CutterApplication::~CutterApplication()
|
CutterApplication::~CutterApplication()
|
||||||
{
|
{
|
||||||
|
QList<CutterPlugin *> plugins = Core()->getCutterPlugins();
|
||||||
|
for (CutterPlugin *plugin : plugins) {
|
||||||
|
delete plugin;
|
||||||
|
}
|
||||||
|
|
||||||
delete mainWindow;
|
delete mainWindow;
|
||||||
delete Python();
|
Python()->shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CutterApplication::event(QEvent *e)
|
bool CutterApplication::event(QEvent *e)
|
||||||
@ -220,8 +225,8 @@ void CutterApplication::loadPlugins()
|
|||||||
|
|
||||||
Python()->addPythonPath(pluginsDir.absolutePath().toLatin1().data());
|
Python()->addPythonPath(pluginsDir.absolutePath().toLatin1().data());
|
||||||
|
|
||||||
CutterPlugin *cutterPlugin = nullptr;
|
|
||||||
foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
|
foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
|
||||||
|
CutterPlugin *cutterPlugin = nullptr;
|
||||||
if (fileName.endsWith(".py")) {
|
if (fileName.endsWith(".py")) {
|
||||||
// Load python plugins
|
// Load python plugins
|
||||||
QStringList l = fileName.split(".py");
|
QStringList l = fileName.split(".py");
|
||||||
@ -241,7 +246,7 @@ void CutterApplication::loadPlugins()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qInfo() << "Loaded" << plugins.length() << "plugins.";
|
qInfo() << "Loaded" << plugins.length() << "plugin(s).";
|
||||||
Core()->setCutterPlugins(plugins);
|
Core()->setCutterPlugins(plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,20 +25,6 @@ PythonManager::PythonManager()
|
|||||||
|
|
||||||
PythonManager::~PythonManager()
|
PythonManager::~PythonManager()
|
||||||
{
|
{
|
||||||
QList<CutterPlugin *> plugins = Core()->getCutterPlugins();
|
|
||||||
for (CutterPlugin *plugin : plugins) {
|
|
||||||
delete plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
restoreThread();
|
|
||||||
|
|
||||||
emit willShutDown();
|
|
||||||
|
|
||||||
Py_Finalize();
|
|
||||||
|
|
||||||
if (pythonHome) {
|
|
||||||
PyMem_RawFree(pythonHome);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonManager::initPythonHome()
|
void PythonManager::initPythonHome()
|
||||||
@ -85,6 +71,19 @@ void PythonManager::initialize()
|
|||||||
saveThread();
|
saveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PythonManager::shutdown()
|
||||||
|
{
|
||||||
|
emit willShutDown();
|
||||||
|
|
||||||
|
restoreThread();
|
||||||
|
|
||||||
|
Py_Finalize();
|
||||||
|
|
||||||
|
if (pythonHome) {
|
||||||
|
PyMem_RawFree(pythonHome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PythonManager::addPythonPath(char *path) {
|
void PythonManager::addPythonPath(char *path) {
|
||||||
restoreThread();
|
restoreThread();
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ public:
|
|||||||
|
|
||||||
void initPythonHome();
|
void initPythonHome();
|
||||||
void initialize();
|
void initialize();
|
||||||
|
void shutdown();
|
||||||
|
|
||||||
void addPythonPath(char *path);
|
void addPythonPath(char *path);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user