mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-19 03:58:28 -05:00
Fix possible crash when loading project files
This fixes a possible crash when loading project files which occurs with some versions of Qt when trying to set the column widths in the Browse Data tab. Thanks to @hertzhaft for spotting and fixing this. See issue #2232.
This commit is contained in:
@@ -784,7 +784,8 @@ void TableBrowser::applySettings(const BrowseDataTableSettings& storedData, bool
|
||||
hideColumns(hiddenIt.key(), hiddenIt.value());
|
||||
|
||||
// Column widths
|
||||
for(auto widthIt=storedData.columnWidths.constBegin();widthIt!=storedData.columnWidths.constEnd();++widthIt)
|
||||
QMap<int, int> w = storedData.columnWidths; // We need to make a copy here because with some versions of Qt
|
||||
for(auto widthIt=w.constBegin();widthIt!=w.constEnd();++widthIt) // the container gets modified in a way which causes a crash
|
||||
{
|
||||
if(widthIt.key() < ui->dataTable->model()->columnCount())
|
||||
ui->dataTable->setColumnWidth(widthIt.key(), widthIt.value());
|
||||
|
||||
Reference in New Issue
Block a user