[PyQt] Segmentation faults
Mailing List SVR
lists at svrinformatica.it
Fri Aug 6 15:53:43 BST 2010
Il giorno gio, 05/08/2010 alle 03.10 -0400, Luke Campagnola ha scritto:
> I believe I have run into a class of bugs in PyQt4. I originally found
> that QSpinBox.lineEdit() returns a QLineEdit instance which does not
> maintain its reference count properly after the original QSpinBox is
> deleted. Thus it is possible to either 1) have uncollectable LineEdits
> lingering in memory, or 2) crash the program by accessing the LineEdit
> (see example below).
>
>
> The same bug also applies to:
> - QAbstractSpinBox.lineEdit
> - QComboBox.lineEdit,
> - QAbstractScrollArea.horizontalScrollBar
> - QAbstractScrollArea.verticalScrollBar
> - QTreeView.header
> - QSplitter.handle
>
>
> .. and likely many others. In the best case, this bug causes minor
> memory leaks that few people are likely to notice. In the worst case,
> it causes crashes which are very difficult to debug if you don't have
> easy access to debugging symbols (ie using windows binaries).
>
>
> $ python
> >>> from PyQt4.QtGui import *
> >>> a = QApplication([])
> >>> s = QSpinBox()
> >>> l = s.lineEdit()
> >>> del s
> >>> l.text()
> Segmentation fault
PySide is more forgiving and raise the following error:
RuntimeError: Internal C++ object already deleted.
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
More information about the PyQt
mailing list