[PyQt] Fwd: Re: help: beforeUpdate QSqlRecord bus error

Jan Haag haag498 at googlemail.com
Mon Aug 23 22:24:53 BST 2010


I'm sorry, this conversation went off-list by my hitting the wrong
button, so I'm re-posting it in the right place.

Jan

-------- Original Message --------
Subject: Re: [PyQt] help: beforeUpdate QSqlRecord bus error
Date: Mon, 23 Aug 2010 13:55:30 -0700
From: Scott Frankel <frankel at circlesfx.com>
To: Jan Haag <haag498 at googlemail.com>


On Aug 23, 2010, at 1:09 PM, Jan Haag wrote:

> On 8/23/10 5:11 PM, Scott Frankel wrote:
>>
>> 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!
>
> It may help to give a _really_ minimal example... However, running  
> your
> script through 2to3 and adding sip.setapi('QVariant', 1), it does not
> yield any errors on Mac 10.6 using python 3.1 with sip-4.10.5 and
> PyQt-mac-gpl-4.7.4 linked against qt-mac-cocoa-opensource-4.6.3 as
> compiled by Nokia.
> Right now I am unable to test other configurations, but this  
> suggests a
> problem which exists only on some configurations... If a clean build  
> of
> all components doesn't work, try something similar in c++... if it  
> still
> doesn't work the issue is with Qt, otherwise it is with PyQt -  
> assuming,
> of course, that a thorough search through the internet didn't turn up
> anything useful - I haven't checked as you should have done that  
> before
> posting anyway.

Yes, I conducted a thorough search through all the documentation,
archives, and webpages I could find for information prior to posting.
Trust me, if I had found information to help explain the crashes, I
wouldn't have posted in the first place.

While I agree that my example code was not reduced to an absolute
least number of lines, bear in mind that I have to create and populate
a database, create and set parameters for a data model, create a small
UI, connect signal to slot, and provide at least one method to
demonstrate the issue.  For the sake of simplicity and brevity, I
provided 6 lines of salient code in the body of my email, along with
two line number call-outs, to present the minimum amount of
information to describe the methodology my app uses.

Thanks for considering my questions and confirming that my methodology
works properly.  I'll pursue the configuration issues you suggest.

Scott

>
> Jan
> <0x1665A74C.asc>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x1665A74C.asc
Type: application/pgp-keys
Size: 3174 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100823/92a9a815/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 905 bytes
Desc: OpenPGP digital signature
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100823/92a9a815/attachment.pgp>


More information about the PyQt mailing list