--- a/src/model.cpp Sun Jan 29 21:17:43 2017 +0200 +++ b/src/model.cpp Mon Jan 30 00:59:06 2017 +0200 @@ -31,13 +31,11 @@ if (object->model() and object->model() != this) object->model()->withdraw(object); - if (not object->model()) - { - _objects.insert(position, object); - _needsTriangleRecount = true; - object->setDocument(this); - print("Object %1 added to position %2", object->id(), position); - } + // TODO: check that the object isn't in the vector once there's a cheap way to do so! + _objects.insert(position, object); + _needsTriangleRecount = true; + object->setDocument(this); + print("Object %1 added to position %2", object->id(), position); } bool Model::swapObjects(LDObject* one, LDObject* other) @@ -93,12 +91,6 @@ delete object; } -void Model::replace(LDObject* object, LDObject* newObject) -{ - if (object->model() == this) - setObjectAt(object->lineNumber(), newObject); -} - void Model::replace(LDObject *object, Model &model) { if (object->model() == this)