Browse Source

Plug database connection leak in SqlQueryView::setQuery()

Neal Wilson 11 years ago
parent
commit
3571c8d534
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      src/typica.w

+ 1
- 2
src/typica.w View File

12721
 
12721
 
12722
 @ The other functions are wrappers around model methods.
12722
 @ The other functions are wrappers around model methods.
12723
 
12723
 
12724
-\danger |setQuery()| leaks database connections.
12725
-
12726
 @<SqlQueryView implementation@>=
12724
 @<SqlQueryView implementation@>=
12727
 void SqlQueryView::setQuery(const QString &query)
12725
 void SqlQueryView::setQuery(const QString &query)
12728
 {
12726
 {
12730
 	database.open();
12728
 	database.open();
12731
 	QSqlQuery q(query, database);
12729
 	QSqlQuery q(query, database);
12732
 	((QSqlQueryModel*)model())->setQuery(q);
12730
 	((QSqlQueryModel*)model())->setQuery(q);
12731
+	database.close();
12733
 }
12732
 }
12734
 
12733
 
12735
 bool SqlQueryView::setHeaderData(int section, Qt::Orientation@, orientation,
12734
 bool SqlQueryView::setHeaderData(int section, Qt::Orientation@, orientation,

Loading…
Cancel
Save