Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove processEvents in PythonEngineWorker::doRun() #810

Closed

Conversation

MinyazevR
Copy link
Member

When the destructor of trikPythonRunner is called, mWorkerThread->quit() is invoked. The finished signal of mWorkerThread is connected to pythonEngineWorker::deleteLater. However, when attempting to free resources immediately after script execution (in PythonEngineWorker::doRun()), calls to QCoreApplication::processEvents reset the interrupt flag set by mWorkerThread->quit(). As a result, QEventLoop::exec calls bloking MsgWaitForMultipleObjectsEx (via QEventDispatcherWin32::processEvents) with the INFINITE flag (specifically for QEventLoop::WaitForMoreEvents), which leads to waiting for a PostMessage call that can be triggered by QEventLoop::wakeUp, QAbstractEventDispatcher::interrupt, or re-calling qthread->quit. Calls to QCoreApplication::processEvents with QEventLoop::WaitForMoreEvents generate the QAbstractEventDispatcher::aboutToBlock signal. This solution should not introduce regression because all current calls to QCoreApplication::processEvents occur with QEventLoop::AllEvents and will not be canceled.

@MinyazevR MinyazevR closed this Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant