ID 556270 - Looping through hiero.ui.windowManager().windows(), returning the parent widget's currentWidget results in RuntimeError: Internal C++ object (PySide2.QtWidgets.QWidget) already deleted

Follow

Problem summary
Looping through hiero.ui.windowManager().windows(), returning the parent widget's currentWidget results in RuntimeError: Internal C++ object (PySide2.QtWidgets.QWidget) already deleted.
 
Customer reported version
hiero.14.0v4
 
Customer reported platform
centos7
 
Steps to reproduce
 
1) Open Hiero

2) Run the following code in the Script Editor, it should print all the currently active widget's from the window's parent:
 
for window in hiero.ui.windowManager().windows():     try:         print("Current Widget: " + str(window.parent().currentWidget()))     except:         print("Window: " + str(window))
 
Expected behaviour
For the widgets to be printed
 
Actual behaviour
Hiero Errors saying:

RuntimeError: Internal C++ object (PySide2.QtWidgets.QWidget) already deleted.
 
Workaround
Declare the problem objects outside of the loop:
parents[]for window in windows:    parent = window.parent()    parents.append(parent)    # do stuff with parents
 
Reproduced by support
This bug has been reproduced in:
Hiero 15.0v1 - Windows 10, CentOS 7, macOS Monterey
Hiero 14.0v1 - Windows 10, CentOS 7, macOS Monterey - regression
 
Unable to reproduce bug in:
Hiero 13.2v8 - Windows 10, CentOS 7, macOS Monterey
 
Earliest version tested
Hiero 13.2v8 - This issue doesn't appear in this version and has regressed
 

    We're sorry to hear that

    Please tell us why