# HG changeset patch # User Santeri Piippo # Date 1396737604 -10800 # Node ID c89b58ba266b80e3d8d7ed1392fcef1b01212e14 # Parent d79083b9f74d6180decc8d84b28e1f94dba54505# Parent 2a1c204df14d4c713a8ae0ccaab7251007a49b55 Merge ../ldforge into gl diff -r d79083b9f74d -r c89b58ba266b src/ldDocument.cc --- a/src/ldDocument.cc Sat Mar 29 05:38:03 2014 +0200 +++ b/src/ldDocument.cc Sun Apr 06 01:40:04 2014 +0300 @@ -1154,9 +1154,13 @@ // void LDDocument::closeUnused() { - for (LDDocument* file : g_loadedFiles) + for (int i = 0; i < g_loadedFiles.size(); ++i) + { + LDDocument* file = g_loadedFiles[i]; + if (file->isImplicit() && file->references().isEmpty()) - delete file; + delete g_loadedFiles[i--]; + } } // =============================================================================