mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 11:56:12 +00:00
Fix Segfault when jupyter is not installed
This commit is contained in:
parent
3cdc6a5230
commit
5313017c54
@ -109,20 +109,23 @@ QVariant JupyterConnection::pollNestedIPyKernel(long id)
|
|||||||
|
|
||||||
bool JupyterConnection::startJupyterNotebook()
|
bool JupyterConnection::startJupyterNotebook()
|
||||||
{
|
{
|
||||||
Python()->restoreThread();
|
PythonManager::ThreadHolder threadHolder;
|
||||||
|
|
||||||
if (!cutterJupyterModule) {
|
if (!cutterJupyterModule) {
|
||||||
cutterJupyterModule = QtResImport("cutter_jupyter");
|
cutterJupyterModule = QtResImport("cutter_jupyter");
|
||||||
|
if (!cutterJupyterModule) {
|
||||||
|
qWarning() << "Failed to load cutter_jupyter module. Make sure jupyter is installed.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* startFunc = PyObject_GetAttrString(cutterJupyterModule, "start_jupyter");
|
PyObject *startFunc = PyObject_GetAttrString(cutterJupyterModule, "start_jupyter");
|
||||||
if (!startFunc) {
|
if (!startFunc) {
|
||||||
qWarning() << "Couldn't get attribute start_jupyter.";
|
qWarning() << "Couldn't get attribute start_jupyter.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cutterNotebookAppInstance = PyObject_CallObject(startFunc, nullptr);
|
cutterNotebookAppInstance = PyObject_CallObject(startFunc, nullptr);
|
||||||
Python()->saveThread();
|
|
||||||
|
|
||||||
return cutterNotebookAppInstance != nullptr;
|
return cutterNotebookAppInstance != nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user