Closed hannesdelbeke closed 1 year ago
approved by Frieder in slack
hmm on further testing this has an issue. it works all nicely, no exception on closing.
but if you launch a qt window, you get a different error on closing now
Error: Not freed memory blocks: 4, total unfreed memory 0.000351 MB
this PR addresses an issue with access violation mentioned in PR https://github.com/techartorg/bqt/pull/42 there is also some logic cleanup, since some funtions are called multiple times or in wrong places.
details:
QApplication is instanced, and a reference is saved in a variable in the QOperator. the blender window is wrapped in QT, and is now managed by pyside/ the QApplication
when closing blender, operators likely get deregistered, which means the reference to QApplication is gone, and QApplication gets garbage collected. but blender is managed by the QApp, which tries to delete all it's widgets etc.
since the operator owns qapp, qapp owns blender, and blender owns the operator. we have a loop.
moving the qapp to a global variable instead of the operator seems to fix the access violation error :D
notes the specific commit that fixes the violation is the removal of the qoperator. replacing it with just a function