Sat, 05 Mar 2022 12:47:10 +0200
fix crash when loading a file
`object` is moved so we cannot access it after moving
src/model.cpp | file | annotate | diff | comparison | revisions |
--- a/src/model.cpp Sat Mar 05 12:42:14 2022 +0200 +++ b/src/model.cpp Sat Mar 05 12:47:10 2022 +0200 @@ -158,8 +158,9 @@ Q_EMIT this->beginInsertRows({}, position, position); this->body.push_back(std::move(object)); Q_EMIT this->endInsertRows(); - this->objectsById[object->id] = object.get(); - return object->id; + const ldraw::id_t id = this->body.back()->id; + this->objectsById[id] = this->body.back().get(); + return id; } /**