[Qt-interest] QSqlQuery + multiple threads = crash
Sean Harmer
sean.harmer at maps-technology.com
Wed Jun 22 17:45:16 CEST 2011
On Thursday 23 June 2011 01:06:03 Tony Rietwyk wrote:
> > Sent: Wednesday, 22 June 2011 23:06 PM
> >
> > On Wednesday 22 June 2011 14:55:19 Emmanuel Bourgerie wrote:
> > > Would QSqlDatabase copyOfDb(*db) be enough ?
> >
> > Just use QSqlDatabase::database( "db-name" ) in your worker
> > thread to get
> > another connection. Then be sure to use each connection only
> > in the thread
> > they were created in.
> >
> > Cheers,
> >
> > Sean
>
> The 4.7.2 QSqlDatabase docs state "If you create multiple database
> connections, specify a unique connection name for each one, when you call
> addDatabase()." I think you need to have separate names to have separate
> connections - at least that's how I've coded my thread pool threads.
Yeah sorry. That is what I was thinking of.
Sean
More information about the Qt-interest-old
mailing list