How to reproduce:
- Open two QSqlDatabase in separate threads in parallel.
- On shutdown when QApplication is freed, there is an endless loop.
I found following cause:
- When two SQL connections are created in parallel, QSqlDatabasePrivate::driverDict() is called twice in parallel. This will call qAddPostRoutine(cleanDriverDict); twice and cleanDriverDict will appear twice in the PostRoutines.
- During shutdown, the second cleanDriverDict calls driverDict() again, which reinitializes qDriverDictInit and adds another qAddPostRoutine. So the cleanDriverDict will be called and added again and again.
|For Gerrit Dashboard: QTBUG-112961|
|479729,1||SQL: Make QSqlDatabase::DriverDict creation thread-safe||tqtc/lts-6.2||qt/tqtc-qtbase||Status: NEW||0||0|
|479730,1||SQL: Make QSqlDatabase::DriverDict creation thread-safe||tqtc/lts-5.15||qt/tqtc-qtbase||Status: NEW||0||0|