Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
1.1.2, 1.2.x
-
None
-
PySide 1.1.2, Head on both Windows 7 and Ubuntu. All 32-bit; 64-bit not tested by me.
Description
If you point the declarative rootContext to the containing object seemingly creating a reference loop the program seg-faults on exit. The call stack appears to be unchecked recursion. This also seems to create other memory corruption even before the program exit. I include a more complicated example as an attachment illustrating this since I think that's the more worrisome bug.
from PySide import QtCore, QtGui, QtDeclarative class MainWindow(QtGui.QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.declview = QtDeclarative.QDeclarativeView() self.setCentralWidget(self.declview) self.context = self.declview.rootContext() self.context.setContextProperty('controller', self) def closeEvent(self, event): # This next line clearing the assumed reference loop allows the program # to close cleanly. #self.context.setContextProperty('controller', None) super(MainWindow, self).closeEvent(event) app = QtGui.QApplication([]) w = MainWindow() w.show() app.exec_()
To illustrate the other memory corruption appears to require the Chaco graphing library (although I suspect that's rather incidental). This seems consistent on my system, but I'm not too confident. The code illustrating it is in the attachment. Select "file > other" in the first window and then "file > graph" in the second window that appears. The program will then crash.