[PyQt] help: beforeUpdate QSqlRecord bus error

Scott Frankel frankel at circlesfx.com
Mon Aug 23 16:11:13 BST 2010


Please excuse the re-post.  I'm at a loss as to why executing a  
QSqlRecord object's count() or isEmpty() method results in a bus error  
crash.  Suggestions would be greatly appreciated.

Thanks!




Hi all,

Can anyone please help shed light on why methods performed on a  
QSqlRecord object would cause bus error crashes?

I'm trying to view data before it's written to my database.   
Connecting to my table model's beforeUpdate signal provides me with  
access to the QSqlRecord for the updating row.  The problem is that  
calling count() or isEmpty(), let alone anything more interesting,  
causes my app to crash with a bus error.

The salient pieces look like this:

	self.theModel           = QtSql.QSqlTableModel(self)
	self.theModel.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)
	self.connect(self.theModel, QtCore.SIGNAL("beforeUpdate(int,  
QSqlRecord &)"), self.test)	
	def test(self, row, record):
		print "test() ...", row
		print "count: ", record.count()


See the attached sample app, line 112, for a working example.  The app  
crashes when the "commit" button is pressed, as it ponders  
record.count() on line 117.

Thanks in advance!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: beforeUpdateTest.py
Type: text/x-python-script
Size: 4826 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100823/15e0de58/attachment.bin>
-------------- next part --------------





More information about the PyQt mailing list