diff options
author | Bill King <bill.king@nokia.com> | 2009-05-13 04:06:47 (GMT) |
---|---|---|
committer | Bill King <bill.king@nokia.com> | 2009-05-13 04:59:32 (GMT) |
commit | dcf1867f5715991e233120122f6252b18ccd26e3 (patch) | |
tree | 6720072e9599a89889714a7f73b5dfa84a1b89db /tests/auto | |
parent | d3f8c08548cf7a454d3fd31c3313031d3e0bb223 (diff) | |
download | Qt-dcf1867f5715991e233120122f6252b18ccd26e3.zip Qt-dcf1867f5715991e233120122f6252b18ccd26e3.tar.gz Qt-dcf1867f5715991e233120122f6252b18ccd26e3.tar.bz2 |
Fixes a segfault from out of order cleanup of mysql resources.
If a QSqlQuery survived the lifetime of removal of a mysql db connection (that failed), the cleanup code would cause a segfault because it was using an out of date pointer that was pointing at memory that'd been freed by the removeDatabase() call.
Revby: Justin McPherson
Task-number: 205701
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qsqlquery/tst_qsqlquery.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 074f16f..7f97972 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -178,9 +178,11 @@ private slots: void task_217003_data() { generic_data(); } void task_217003(); #endif - void task_250026_data() { generic_data("QODBC"); } void task_250026(); + void task_205701_data() { generic_data("QMYSQL"); } + void task_205701(); + private: @@ -297,7 +299,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) #ifdef NOT_READY_YET tablenames << qTableName( "Planet" ); #endif - tablenames << qTableName( "task_250026" ); + tablenames << qTableName( "task_250026" ); tst_Databases::safeDropTables( db, tablenames ); } @@ -2711,5 +2713,21 @@ void tst_QSqlQuery::task_250026() QCOMPARE( q.value( 0 ).toString().length(), data1026.length() ); } +void tst_QSqlQuery::task_205701() +{ + QSqlDatabase qsdb = QSqlDatabase::addDatabase("QMYSQL", "atest"); + qsdb.setHostName("test"); + qsdb.setDatabaseName("test"); + qsdb.setUserName("test"); + qsdb.setPassword("test"); + qsdb.open(); + +// { + QSqlQuery query(qsdb); +// } + QSqlDatabase::removeDatabase("atest"); +} + + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" |