translate() calls in QtSql

Nick Shaforostoff shafff at ukr.net
Mon May 18 01:57:26 BST 2009


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?




More information about the kde-core-devel mailing list