mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-04 01:08:26 +02:00
[ImageGallery] Do not fill intrinsics model until it has been instantiated
In some cases, like when opening the most recent file from the command line, switching the color palette or hot reloading, the intrinsics might be parsed and ready to populate the intrinsics' `TableModel` while the model itself is being instantiated. To prevent crashes, we forbid operations on the `TableModel` until it has been fully instantiated.
This commit is contained in:
parent
935f5d07db
commit
f1a83628a6
1 changed files with 14 additions and 0 deletions
|
@ -75,6 +75,11 @@ Panel {
|
|||
}
|
||||
|
||||
function populate_model() {
|
||||
if (!intrinsicModel.ready) {
|
||||
// If the TableModel is not done being instantiated, do nothing
|
||||
return
|
||||
}
|
||||
|
||||
intrinsicModel.clear()
|
||||
for (var intr in parsedIntrinsic) {
|
||||
intrinsicModel.appendRow(parsedIntrinsic[intr])
|
||||
|
@ -569,6 +574,8 @@ Panel {
|
|||
|
||||
TableModel {
|
||||
id : intrinsicModel
|
||||
property bool ready: false
|
||||
|
||||
// Hardcoded default width per column
|
||||
property var columnWidths: [105, 75, 75, 75, 60, 60, 60, 60, 200, 60, 60, 60]
|
||||
property var columnNames: [
|
||||
|
@ -599,6 +606,13 @@ Panel {
|
|||
TableModelColumn { display: function(modelIndex){return parsedIntrinsic[modelIndex.row][intrinsicModel.columnNames[10]]} }
|
||||
TableModelColumn { display: function(modelIndex){return parsedIntrinsic[modelIndex.row][intrinsicModel.columnNames[11]]} }
|
||||
//https://doc.qt.io/qt-5/qml-qt-labs-qmlmodels-tablemodel.html#appendRow-method
|
||||
|
||||
Component.onCompleted: {
|
||||
ready = true
|
||||
// Triggers "populate_model" in case the intrinsics have been filled while the model was
|
||||
// being instantiated
|
||||
root.populate_model()
|
||||
}
|
||||
}
|
||||
|
||||
//CODE FOR HEADERS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue