mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +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()
|
||||
{
|
||||
QList<CutterPlugin *> plugins = Core()->getCutterPlugins();
|
||||
for (CutterPlugin *plugin : plugins) {
|
||||
delete plugin;
|
||||
}
|
||||
|
||||
delete mainWindow;
|
||||
delete Python();
|
||||
Python()->shutdown();
|
||||
}
|
||||
|
||||
bool CutterApplication::event(QEvent *e)
|
||||
@ -220,8 +225,8 @@ void CutterApplication::loadPlugins()
|
||||
|
||||
Python()->addPythonPath(pluginsDir.absolutePath().toLatin1().data());
|
||||
|
||||
CutterPlugin *cutterPlugin = nullptr;
|
||||
foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
|
||||
CutterPlugin *cutterPlugin = nullptr;
|
||||
if (fileName.endsWith(".py")) {
|
||||
// Load python plugins
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -25,20 +25,6 @@ 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()
|
||||
@ -85,6 +71,19 @@ void PythonManager::initialize()
|
||||
saveThread();
|
||||
}
|
||||
|
||||
void PythonManager::shutdown()
|
||||
{
|
||||
emit willShutDown();
|
||||
|
||||
restoreThread();
|
||||
|
||||
Py_Finalize();
|
||||
|
||||
if (pythonHome) {
|
||||
PyMem_RawFree(pythonHome);
|
||||
}
|
||||
}
|
||||
|
||||
void PythonManager::addPythonPath(char *path) {
|
||||
restoreThread();
|
||||
|
||||
|
@ -21,6 +21,8 @@ public:
|
||||
|
||||
void initPythonHome();
|
||||
void initialize();
|
||||
void shutdown();
|
||||
|
||||
void addPythonPath(char *path);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user