Running script after thread termination
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
Hello.
We run python scripts in a separate thread to avoid any blockings of our GUI.
If we want to stop the execution the thread is terminated (QThread::terminate()).
This termination works - in most cases.
It will not work if we execute a script with a blocking python operation. For example a script like this:
In this case the next execution of PythonQt::createUniqueModule or PythonQt::evalScript will crash in python35.dll with the following message:
The call stack looks like this:
I understand that the behaviour after a thread termination may be undefined and that the python35.dll will not work correctly after its execution thread was terminated.
What we need is a way to reinitialize PythonQt and the python35.dll.
Calling
after thread termination is not sufficient. It will still crash.
Is there a way to reinitialize PythonQt completly? If so, how does it work?
Or are there any other ways of terminating a blocking operation, maybe some kind of "soft kills"?
Any advice is appreciated.
Sorry, I have no idea how that could be done. QThread::terminate is surely something you should avoid.