@@ -536,6 +536,15 @@ void TableBrowser::refresh()
536536 });
537537 }
538538
539+ // Delete settings of no-longer existent tables
540+ for (auto it = m_settings.cbegin (); it != m_settings.cend (); ) {
541+ if (!db->getTableByName (it->first )) {
542+ it = m_settings.erase (it);
543+ } else {
544+ ++it;
545+ }
546+ }
547+
539548 // Retrieve the stored data for this table if there is any. If there are no settings for this table,
540549 // this will insert and return a settings object with default values.
541550 const sqlb::ObjectIdentifier tablename = currentlyBrowsedTableName ();
@@ -551,9 +560,9 @@ void TableBrowser::refresh()
551560 emit currentTableChanged (tablename);
552561
553562 // Build query and apply settings
554- applyModelSettings (storedData, buildQuery (storedData, tablename));
555- applyViewportSettings (storedData, tablename);
556- emit updatePlot (ui->dataTable , m_model, &m_settings[tablename], true );
563+ applyModelSettings (storedData, buildQuery (storedData, tablename));
564+ applyViewportSettings (storedData, tablename);
565+ emit updatePlot (ui->dataTable , m_model, &m_settings[tablename], true );
557566}
558567
559568void TableBrowser::clearFilters ()
0 commit comments