0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

memory leak fixed

This commit is contained in:
Arin Alex 2018-03-07 20:04:30 +03:00
parent 5d7a116f31
commit 215af87910

View File

@ -70,7 +70,7 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
m_mode = mode;
QSqlDatabase db = QSqlDatabase::database(m_connectionName);
QSqlQuery* query = new QSqlQuery(db);
QSqlQuery query(db);
if (!db.isValid()) {
setLastError(QObject::tr("Invalid connection! %1").arg(m_connectionName));
@ -82,13 +82,12 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
if (!m_prepared) return false;
}
query->prepare(m_preparedSQL);
fillParams(query);
query->exec();
query.prepare(m_preparedSQL);
fillParams(&query);
query.exec();
QSqlQueryModel *model = new QSqlQueryModel;
model->setQuery(*query);
model->setQuery(query);
while (model->canFetchMore())
model->fetchMore();