Could this be a possible bug for Qt's SQL database?
I have met a problem stated in this question: http://qt-project.org/forums/viewthread/49138/
After I have done some research and asked some of my friends. I found that the default constructor of
QSqlDatabase might be the problem.
Here is the thing:
The default constructor of QSqlDatabase used a shared_null.
Note that the shared_null is an object indicating an invalid database, not a plain null pointer.
You can see these are static variables in the function, and -- static variable initialization is not thread-safe!
So, if you call these default constructors in different threads, there might be problems, in my case, my suspicion is that the shared_null is initialized twice due to this kind of race condition. As a result, the ref counting went wrong and the delete is called on this static object (which should not be delete-able).
I am new to Qt, any one have great ideas about this?
That question would be more suited for the interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)