techartorg / bqt

A Blender add-on to support & manage Qt Widgets in Blender (PySide2)
https://github.com/techartorg/bqt/wiki
Mozilla Public License 2.0
172 stars 25 forks source link

blender_window garbage collect bug #45

Closed hannesdelbeke closed 1 year ago

hannesdelbeke commented 1 year ago

when trying to get the parent from the blender widget python returns an exception instead please note first time you run this in blender it works, but second time you get error.

from PySide2.QtWidgets import QApplication
app = QApplication.instance()
a = app._blender_window.parent() 

# first time
# <PySide2.QtGui.QWindow(0x1e6a52d5120, name="QWindowContainerClassWindow") at 0x000001E6A66E7340>

# second
# Error: Python: Traceback (most recent call last):
#  File "\Text", line 3, in <module>
# RuntimeError: Internal C++ object (PySide2.QtGui.QWindow) already deleted.

same if you try access the children, or any other attr

Originally posted by @hannesdelbeke in https://github.com/techartorg/bqt/issues/42#issuecomment-1270760729