Hello, New PySide user here with an issue that my app/script crashes sometimes when QTableWidget.clear() is called. It is reproducible but I can't understand why it crashes when it does. The script fills the table with data from an array that meet some criteria. I select a cell/ row and press a button that causes all the data from the selected row to be written to a file. Then the table is cleared and re-filled with a new set of data. If I select a certain cell from certain sets, the crash occurs. But selecting the same cell in other sets doesn't cause the crash. Selecting a different cell in the same row/ same set as 'crasher selection' can prevent the crash. Crashes occur perhaps about 2% of the time. I can't understand why it occurs, but then again I know very little about Qt and its MVC classes. Here is some code: The window: from PySide import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(800, 600) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayoutWidget = QtGui.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(170, 20, 160, 80)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setMargin(0) self.verticalLayout.setObjectName("verticalLayout") self.tableWidget = QtGui.QTableWidget(self.centralwidget) self.tableWidget.setGeometry(QtCore.QRect(10, 110, 781, 451)) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(0) self.tableWidget.setRowCount(0) The app: def main(): array1 = numpy.loadtxt(open("aa_count.csv"), delimiter=',', dtype={'names' :('dh', 'ds', 'count' ), 'formats': ('f4', 'f4', 'i4' ) } ) array2 = numpy.loadtxt(open("aa_full.csv"), delimiter=',', dtype={'names' :('id', 'dh', 'ds', 'name1', 'name2', 'name3', 'name4' ), 'formats': ('i4', 'f4', 'f4', 'S2', 'S2', 'S2', 'S2' ) } ) writer1 = csv.writer(open("aa_prime.csv", "wb"), dialect = 'excel' ) app = QApplication(sys.argv) frame = MainWindow(dataArray = array2, dataCounts = array1, outWriter=writer1) frame.show() app.exec_() The Window Class class MainWindow( QMainWindow, Ui_MainWindow): def __init__(self, parent= None, dataArray=None, dataCounts = None, outWriter = None): super( MainWindow,self).__init__(parent) self.setupUi(self) self.outWriter = outWriter self.dataArray = dataArray self.dataCounts = dataCounts self.dataCountRow = 0 self.tableWidget.setColumnCount( 7 ) #filling the table def showGroup(self): self.tableWidget.clear() self.tableWidget.setHorizontalHeaderLabels( self.dataArray.dtype.names ) dhval = self.dataCounts[self.dataCountRow ] ['dh'] dsval = self.dataCounts[self.dataCountRow ] ['ds'] activeRows = self.dataArray[ (self.dhs == dhval) * (self.dss == dsval) ] self.rowNumber.setText( str( self.dataCountRow + 1 ) ) irow = 0 for rowX in activeRows: if not self.filterRow( rowX): irow += 1 self.tableWidget.setRowCount( irow ) irow = 0 for rowX in activeRows: if not self.filterRow( rowX): self.tableWidget.setItem( irow, 0, QTableWidgetItem(self.tr(str( rowX[0] ))) ) self.tableWidget.setItem( irow, 1, QTableWidgetItem(self.tr(str( rowX[1] ))) ) self.tableWidget.setItem( irow, 2, QTableWidgetItem(self.tr(str( rowX[2] ))) ) self.tableWidget.setItem( irow, 3, QTableWidgetItem(self.tr(str( rowX[3] ))) ) self.tableWidget.setItem( irow, 4, QTableWidgetItem(self.tr(str( rowX[4] ))) ) self.tableWidget.setItem( irow, 5, QTableWidgetItem(self.tr(str( rowX[5] ))) ) self.tableWidget.setItem( irow, 6, QTableWidgetItem(self.tr(str( rowX[6] ))) ) irow += 1 self.tableWidget.setFocus() #getting the data out of the table def acceptSelectedRow(self): import pdb # pdb.set_trace() item = self.tableWidget.currentItem() if item and item.row() >= 0: rowNum = item.row() rows = [] for col in xrange(self.tableWidget.columnCount() ): it = self.tableWidget.item( rowNum, col) rows.append( it.text() ) if self.outWriter: self.outWriter.writerow ( rows ) item = None self.nextGroup() |
_______________________________________________
PySide mailing list
PyS...@lists.pyside.org
http://lists.pyside.org/listinfo/pyside
Thank you. Is there a HOW-TO for doing that? My initial guess is that I have to: 1. Download the QT source (I'll use Qt-win-opensource-4.7.2.-vs2008) 2: build the debug versions 3: copy somewhere 4: edit my qt.conf located at c:\Python26 Is that right? --- On Wed, 3/30/11, Erik Janssens <Erik.J...@conceptive.be> wrote: |
| Using linux is no problem. I have an openSuse11.2 VM on my machine. I've installed pyside and its reqs. I even easy_installed your camelot to check it out, BTW. I'm not quite sure what I need to do now. Something similar to my plan for Windows, or something else. |
I forgot to add that I can reproduce this issue now in non-debug mode on linux: I see the following on the console *** glibc detected *** python: double free or corruption (fasttop): 0x0885d2c0 *** --- On Wed, 3/30/11, Keith Gunderson <kr...@yahoo.com> wrote: |
-----Inline Attachment Follows----- |
| done. I'm glad you're helping me because I'm really lost when I try to find info from nokia's website. I'm not sure what to do next. |
Hi Keith,
If you're not very much into debugging the internals of PySide itself, I
wouldn't bother with rebuilding a debug version of PySide. Instead,
report the issue in our Bugzilla at http://bugs.pyside.org. Since this
is, according to your description, a reproducible crasher bug, it's by
definition a high-priority issue and should be resolved in a short time.
Cheers,
ma.
the QT MVC classes are full with ASSERT statements and it's
very easy to 'abuse' them ...
On Fri, 2011-04-01 at 11:54 -0700, Keith Gunderson wrote:
> Well, I reported the issue (#799).
>
> I also built a debug version of pyside and qt. The only output I get
> when the issue happens is:
>
> *** glibc detected *** python: double free or corruption (fasttop):
> 0x088f03a0 ***
>
> Then, the app freezes and I have to kill it.
>
>
>
> ______________________________________________________________________