QSqlDatabase::addDatabase not thread safe with plugin

Although the method is marked as thread safe in the docs, if you use a
database plugin it ends up not being thread safe.
Merge pull request #1054 from DonLakeFlyer/ThreadSafety

QSqlDatabase::addDatabase not thread safe with plugin