# HG changeset patch # User Santeri Piippo # Date 1520092772 -7200 # Node ID b153b6b248cea706b172ebe959e0f32fcc05d2f7 # Parent eeaca12d3d760942bba53f68fadb5ab69b2613cc removed another LDObject::model() use diff -r eeaca12d3d76 -r b153b6b248ce src/model.h --- a/src/model.h Sat Mar 03 17:57:35 2018 +0200 +++ b/src/model.h Sat Mar 03 17:59:32 2018 +0200 @@ -179,15 +179,18 @@ template T* Model::emplaceReplacement(LDObject* object, Args&& ...args) { - if (object->model() == this) + QModelIndex position = this->indexOf(object); + + if (position.isValid()) { - QModelIndex position = indexOf(object); T* replacement = constructObject(args...); setObjectAt(position.row(), replacement); return replacement; } else + { return nullptr; + } } /*