translate() calls in QtSql

Matt Rogers mattr at kde.org
Mon May 18 02:17:55 BST 2009


On May 17, 2009, at 7:57 PM, Nick Shaforostoff wrote:

> My user was hit by this crash: https://bugs.kde.org/show_bug.cgi?id=193063
>
> Apparently, it is caused by calling QCoreApplication::translate from  
> QSQLiteResultPrivate::fetchNext (running in background thread in my  
> app):
> http://cep.xor.aps.anl.gov/software/qt4-x11-4.2.2-browser/d8/d09/qsql__sqlite_8cpp-source.html
>
> Note that the error text is set immediately, and not when it is  
> requested by a programmer.
> (i.e. by calling QSqlQuery::lastError ()).
> (so that he at least could protect such calls with mutexes)
>
> It is common to run queries in background thread, so any program  
> that does this is prone to crashes.
>
> So one solution that came to my mind is switching to lazy setting of  
> error texts:
> the driver sets error code, and when the error text is requested,  
> the text is looked up in special table.
>
> What do you think?
> Should I file the bug report to Qt?

If you have the time, you could make the fix in Qt itself now and then  
send a merge request, since the code is open now.
--
Matt




More information about the kde-core-devel mailing list