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 <[email protected]> wrote: From: Keith Gunderson <[email protected]> Subject: Re: [PySide] Some crashes using QTableWidget To: Cc: [email protected] Date: Wednesday, March 30, 2011, 3:59 PM 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. --- On Wed, 3/30/11, Erik Janssens <[email protected]> wrote: From: Erik Janssens <[email protected]> Subject: Re: [PySide] Some crashes using QTableWidget To: "Keith Gunderson" <[email protected]> Cc: [email protected] Date: Wednesday, March 30, 2011, 3:01 PM that 'might' work, I'm not sure you could try to just copy the debug dll's over the dll's you're using now (not sure how that goes on Windows), not sure if you need to recompile PySide I have my own Windows build to be able to fine tune everything ( http://www.python-camelot.com/cpd.html ), unfortunately I don't have a debug build for windows available yet If you have access to a Linux machine, things might be a lot easier On Wed, Mar 30, 2011 at 9:53 PM, Keith Gunderson <[email protected]> wrote: 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 <[email protected]> wrote: From: Erik Janssens <[email protected]> Subject: Re: [PySide] Some crashes using QTableWidget To: "Keith Gunderson" <[email protected]>, [email protected] Date: Wednesday, March 30, 2011, 2:17 PM it might help to run QT in debug mode the whole MVC stuff has a lot of asserts, so you might be informed earlier on on what goes wrong On Wed, Mar 30, 2011 at 8:45 PM, Keith Gunderson <[email protected]> wrote: 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 [email protected] http://lists.pyside.org/listinfo/pyside _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside -----Inline Attachment Follows----- _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
_______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
