src/ldtypes.cpp

changeset 484
5b5c77c7f3dd
parent 464
3779a14d597c
child 486
25747c37c7be
--- a/src/ldtypes.cpp	Sat Aug 24 16:30:30 2013 +0300
+++ b/src/ldtypes.cpp	Sat Aug 24 16:52:45 2013 +0300
@@ -229,11 +229,14 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDObject::swap (LDObject* other) {
-	for (LDObject*& obj : *file()) {
+	int i = 0;
+	for (LDObject* obj : file()->objects()) {
 		if (obj == this)
-			obj = other;
+			file()->setObject (i, other);
 		elif (obj == other)
-			obj = this;
+			file()->setObject (i, this);
+		
+		++i;
 	}
 
 	file()->addToHistory (new SwapHistory (id(), other->id()));
@@ -348,7 +351,7 @@
 		const long idx = obj->getIndex(),
 			target = idx + (up ? -1 : 1);
 		
-		if ((up && idx == 0) || (!up && idx == (long) (file->objs().size() - 1))) {
+		if ((up && idx == 0) || (!up && idx == (long) (file->objects().size() - 1))) {
 			// One of the objects hit the extrema. If this happens, this should be the first
 			// object to be iterated on. Thus, nothing has changed yet and it's safe to just
 			// abort the entire operation.

mercurial