From 6c8e577507d3d7f18180b59fcd1369c22e6ae903 Mon Sep 17 00:00:00 2001 From: Andrew Mustun Date: Mon, 28 Oct 2013 09:45:28 +0100 Subject: [PATCH] fix FS#959 - Trimming two lines which already meet causes both to disappear after saving --- src/core/RMemoryStorage.cpp | 1 + src/core/RStorage.cpp | 1 + src/core/RTransaction.cpp | 5 +++-- src/io/dxf/RDxfExporter.cpp | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/RMemoryStorage.cpp b/src/core/RMemoryStorage.cpp index f31731ebe8..0368959b8a 100644 --- a/src/core/RMemoryStorage.cpp +++ b/src/core/RMemoryStorage.cpp @@ -891,6 +891,7 @@ bool RMemoryStorage::deleteObject(RObject::Id objectId) { QSharedPointer entity = queryEntityDirect(objectId); if (!entity.isNull()) { blockEntityMap.remove(entity->getBlockId(), entity); + //qDebug() << "deleteObject: removed " << entity->getId() << " from block " << entity->getBlockId(); } return true; diff --git a/src/core/RStorage.cpp b/src/core/RStorage.cpp index c15a9c1040..2ed1ecc901 100644 --- a/src/core/RStorage.cpp +++ b/src/core/RStorage.cpp @@ -220,6 +220,7 @@ QDebug operator<<(QDebug dbg, RStorage& s) { continue; } dbg.nospace() << *b.data() << "\n"; + dbg.nospace() << "block entities: " << s.queryBlockEntities(id) << "\n"; } } diff --git a/src/core/RTransaction.cpp b/src/core/RTransaction.cpp index 26714a53aa..fc5d42eafb 100644 --- a/src/core/RTransaction.cpp +++ b/src/core/RTransaction.cpp @@ -583,8 +583,6 @@ bool RTransaction::addObject(QSharedPointer object, return false; } - storage->removeObject(oldObject); - // iterate through all properties of the original object // and store the property changes (if any) in this transaction: QSet propertyTypeIds; @@ -644,6 +642,9 @@ bool RTransaction::addObject(QSharedPointer object, } if (objectHasChanged) { + // remove old entity from storage (only if it has actually changed): + storage->removeObject(oldObject); + if (object->getDocument()!=NULL) { // only remove from si, if not linked storage / preview if (!storage->isInBackStorage(oldObject->getId())) { diff --git a/src/io/dxf/RDxfExporter.cpp b/src/io/dxf/RDxfExporter.cpp index 87382677ec..908bce5d9f 100644 --- a/src/io/dxf/RDxfExporter.cpp +++ b/src/io/dxf/RDxfExporter.cpp @@ -286,7 +286,9 @@ bool RDxfExporter::exportFile(const QString& fileName, const QString& nameFilter dw->sectionEntities(); QSet blockEntityIds = document->queryBlockEntities(document->getModelSpaceBlockId()); + //qDebug() << "writing model space entities with IDs: " << blockEntityIds; QList list = document->getStorage().orderBackToFront(blockEntityIds); + //qDebug() << "writing ordered entities with IDs: " << list; for (int i=0; i