diff --git a/limereport/databrowser/lrdatabrowser.cpp b/limereport/databrowser/lrdatabrowser.cpp index 0b4ac5a..ef0e556 100644 --- a/limereport/databrowser/lrdatabrowser.cpp +++ b/limereport/databrowser/lrdatabrowser.cpp @@ -702,7 +702,7 @@ void DataBrowser::on_dataTree_currentItemChanged(QTreeWidgetItem *current, QTree Q_UNUSED(previous) if (current&&(current->type() == DataBrowserTree::Connection)) { bool internalConnection = m_report->dataManager()->connectionByName(ConnectionDesc::connectionNameForReport(current->text(0))); - if (m_report->dataManager()->isConnectionConnected(current->text(0))){ + if (m_report->dataManager()->isConnectionConnected(ConnectionDesc::connectionNameForReport(current->text(0)))){ ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-connect.png")); } else { ui->pbConnect->setIcon(QIcon(":/databrowser/images/plug-disconnect.png")); diff --git a/limereport/lrdatasourcemanager.cpp b/limereport/lrdatasourcemanager.cpp index 4da9e63..272c60b 100644 --- a/limereport/lrdatasourcemanager.cpp +++ b/limereport/lrdatasourcemanager.cpp @@ -650,15 +650,18 @@ void DataSourceManager::removeConnection(const QString &connectionName) { QList::iterator cit = m_connections.begin(); while( cit != m_connections.end() ){ - if ( ((*cit)->name().compare(connectionName) == 0) && (*cit)->isInternal() ){ + if ( ((*cit)->name().compare(connectionName) == 0) ){ + if ((*cit)->isInternal()) { QSqlDatabase db = QSqlDatabase::database(connectionName); db.close(); } QSqlDatabase::removeDatabase(connectionName); + delete (*cit); + cit = m_connections.erase(cit); + } else { + cit++; } - delete (*cit); - cit = m_connections.erase(cit); } emit datasourcesChanged(); }