Skip to content

Commit 1392397

Browse files
committed
Hotfix: Failed assertion when editing photos in ascent viewer
1 parent 477e3fe commit 1392397

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/db/table.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ void Table::updateRowInNormalTable(QWidget& parent, const ValidItemID primaryKey
489489
const QVariant currentValue = buffer.getCell(bufferIndex, column->getIndex());
490490
if (currentValue == newValue) columnDataPairs.remove(i);
491491
}
492+
if (columnDataPairs.isEmpty()) return;
492493

493494
updateRowsInNormalTable(parent, { bufferIndex }, columnDataPairs);
494495
}

src/viewer/ascent_viewer.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,9 @@ void AscentViewer::savePhotosList()
832832
for (int i = 0; i < photos.size(); i++) {
833833
photos[0].sortIndex = i;
834834
}
835+
db.beginChangingData();
835836
db.photosTable.updateRows(*this, FORCE_VALID(currentAscentID), photos);
837+
db.finishChangingData();
836838
}
837839

838840

@@ -849,7 +851,9 @@ void AscentViewer::saveDescription()
849851
QString newDescription = descriptionTextBrowser->toPlainText();
850852
bool descriptionChanged = db.ascentsTable.descriptionColumn.getValueFor(FORCE_VALID(currentAscentID)) != newDescription;
851853
if (descriptionChanged) {
854+
db.beginChangingData();
852855
db.ascentsTable.updateCell(*this, FORCE_VALID(currentAscentID), db.ascentsTable.descriptionColumn, newDescription);
856+
db.finishChangingData();
853857
}
854858
}
855859

0 commit comments

Comments
 (0)