diff options
author | Kimmo Kotajärvi <kimmo.kotajarvi@nomovok.com> | 2010-05-26 12:53:23 (GMT) |
---|---|---|
committer | Charles Yin <charles.yin@nokia.com> | 2010-08-11 04:34:21 (GMT) |
commit | 0c9866d6b23062bc08e739b66f41de200b660df4 (patch) | |
tree | dafff79a10cc0cdbebd2b3f8f413c9f91309c40b /src/sql | |
parent | 0b2aa80f596c79d3aab3f44b9a1550b22fde48ca (diff) | |
download | Qt-0c9866d6b23062bc08e739b66f41de200b660df4.zip Qt-0c9866d6b23062bc08e739b66f41de200b660df4.tar.gz Qt-0c9866d6b23062bc08e739b66f41de200b660df4.tar.bz2 |
Fix for QTBUG-2182: "connection still in use" warnings.
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/kernel/qsqldatabase.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 76bc2b0..324a3ce 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -163,7 +163,7 @@ public: static QSqlDatabase database(const QString& name, bool open); static void addDatabase(const QSqlDatabase &db, const QString & name); static void removeDatabase(const QString& name); - static void invalidateDb(const QSqlDatabase &db, const QString &name); + static void invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn = true); static DriverDict &driverDict(); static void cleanConnections(); }; @@ -197,7 +197,7 @@ void QSqlDatabasePrivate::cleanConnections() QConnectionDict::iterator it = dict->begin(); while (it != dict->end()) { - invalidateDb(it.value(), it.key()); + invalidateDb(it.value(), it.key(), false); ++it; } dict->clear(); @@ -229,9 +229,9 @@ QSqlDatabasePrivate *QSqlDatabasePrivate::shared_null() return &n; } -void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name) +void QSqlDatabasePrivate::invalidateDb(const QSqlDatabase &db, const QString &name, bool doWarn) { - if (db.d->ref != 1) { + if (db.d->ref != 1 && doWarn) { qWarning("QSqlDatabasePrivate::removeDatabase: connection '%s' is still in use, " "all queries will cease to work.", name.toLocal8Bit().constData()); db.d->disable(); |