# HG changeset patch # User Teemu Piippo # Date 1410034706 -10800 # Node ID 5dcd2e741d1c9de3fb470b9f7fbd5cd96f142808 # Parent c5b3bc08e609c692acd8979b608f48d38d351cb2 - fixed documentless objects being selected on document close diff -r c5b3bc08e609 -r 5dcd2e741d1c src/extPrograms.cc --- a/src/extPrograms.cc Sat Sep 06 20:40:58 2014 +0300 +++ b/src/extPrograms.cc Sat Sep 06 23:18:26 2014 +0300 @@ -281,9 +281,9 @@ if (not err.isEmpty()) { CriticalError (format ("%1 failed: %2\n", g_extProgNames[prog], err)); - QString filename ("externalProgramOutput.txt"); QFile file (filename); + if (file.open (QIODevice::WriteOnly | QIODevice::Text)) { file.write (proc.readAllStandardOutput()); @@ -295,6 +295,7 @@ print ("Couldn't open %1 for writing: %2", QFileInfo (filename).absoluteFilePath(), file.errorString()); } + return false; } diff -r c5b3bc08e609 -r 5dcd2e741d1c src/ldDocument.cc --- a/src/ldDocument.cc Sat Sep 06 20:40:58 2014 +0300 +++ b/src/ldDocument.cc Sat Sep 06 23:18:26 2014 +0300 @@ -159,6 +159,9 @@ if (IsExiting()) return; + for (LDObjectPtr obj : m_objects) + obj->setSelected (false); + g_allDocuments.removeOne (self()); m_flags |= DOCF_IsBeingDestroyed; delete m_history; diff -r c5b3bc08e609 -r 5dcd2e741d1c src/ldObject.cc --- a/src/ldObject.cc Sat Sep 06 20:40:58 2014 +0300 +++ b/src/ldObject.cc Sat Sep 06 23:18:26 2014 +0300 @@ -337,6 +337,16 @@ // ============================================================================= // +void LDObject::setDocument (const LDDocumentWeakPtr& a) +{ + m_document = a; + + if (a == null) + setSelected (false); +} + +// ============================================================================= +// static void TransformObject (LDObjectPtr obj, Matrix transform, Vertex pos, LDColor parentcolor) { switch (obj->type()) diff -r c5b3bc08e609 -r 5dcd2e741d1c src/ldObject.h --- a/src/ldObject.h Sat Sep 06 20:40:58 2014 +0300 +++ b/src/ldObject.h Sat Sep 06 23:18:26 2014 +0300 @@ -95,7 +95,7 @@ PROPERTY (public, bool, isSelected, setSelected, STOCK_WRITE) PROPERTY (public, bool, isDestructed, setDestructed, STOCK_WRITE) PROPERTY (public, LDObjectWeakPtr, parent, setParent, STOCK_WRITE) - PROPERTY (public, LDDocumentWeakPtr, document, setDocument, STOCK_WRITE) + PROPERTY (public, LDDocumentWeakPtr, document, setDocument, CUSTOM_WRITE) PROPERTY (private, int32, id, setID, STOCK_WRITE) PROPERTY (public, LDColor, color, setColor, CUSTOM_WRITE) PROPERTY (private, QColor, randomColor, setRandomColor, STOCK_WRITE)