[PyKDE] QSqlDatabase.close() causes python core dump.

Hans-Peter Jansen hpj at urpla.net
Sat Mar 13 22:19:01 GMT 2004


[I prefer keeping such conversations on the list, btw]

On Saturday 13 March 2004 16:06, Mike Meyer wrote:
> In <200403131224.12481.hpj at urpla.net>, Hans-Peter Jansen 
<hpj at urpla.net> typed:
> > On Saturday 13 March 2004 11:03, Phil Thompson wrote:
> > > On Saturday 13 March 2004 05:07, Mike Meyer wrote:
> > > > I've got a class that keeps a QSqlDatabase as a feature. At
> > > > one point, I want to close and reopen the database. Everytime
> > > > I hit the call to close, I get a core dump from python.
> > > > Examing that with gdb shows that it is indeed in
> > > > QSqlDatabase::close. Adding an isOpen test before the call to
> > > > close causes it do dump core in QSqlDatabase::isOpen.
> > > >
> > > > I worked around the problem by just not closing the database,
> > > > but I feel that this ought to be looked into.
> > >
> > > A small but complete example would help.
> >
> > .. or look into examples3/SQL/runsqlex.py: MainWindow.dbConnect()
> > which does exactly that, when you connect to some database a 2nd
> > time (without crashing here, btw [sip 3.10.1, PyQt 3.11, Qt
> > 3.2.1]).
>
> Found it. I was opening a second QSqlDatabase using the same
> connection name, which I then closed. So I was trying to close a
> closed connection.
>
> I've attached a small sample program which will demonstrate this.
> This is on FreeBSD 4.9, using sip 4.0r2, Qt 3.2.3, pyQt 3.10, and
> Python 2.3.3.

Got your mail twice, but none though the ML. You may consider 
resending your example over there.

>
> I still believe this is a bug, as it shouldn't cause python to dump
> core.

Well, this is just "normal" qt behaviour, I believe, you're able to 
reproduce exactly this effect in C++, too, so possibly complain to 
trolltech. 

I could be wrong, but if I'm right, then let me note, that IMHO, Phil 
is right in his decision to not even try to workaround such bugs, 
since this keeps his python binding layer ultra thin and 
exceptionally fast, compared to other approaches.

> 	Thanks,
> 	<mike

You're welcome,
Pete




More information about the PyQt mailing list