]> Shamusworld >> Repos - architektonas/blobdiff - src/container.cpp
First stabs at sizing dimension lines properly.
[architektonas] / src / container.cpp
index 8a9c07bcc297a64193d7b8c98ee0b27e2de874c3..e125672eac63c6690d4d1cbc4da044e08a9e6ee7 100644 (file)
@@ -4,11 +4,13 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
 // JLH  03/30/2011  Created this file
+// JLH  06/02/2011  Added code to delete objects in this container when they go
+//                  out of scope
 //
 
 #include "container.h"
@@ -23,9 +25,15 @@ Container::Container(Vector p1, Object * p/*= NULL*/): Object(p1, p),
 
 Container::~Container()
 {
+       // No memory leaks!
+       while (objects.size() > 0)
+       {
+               delete objects[0];
+               objects.erase(objects.begin());
+       }
 }
 
-/*virtual*/ void Container::Draw(QPainter * painter)
+/*virtual*/ void Container::Draw(Painter * painter)
 {
        for(int i=0; i<(int)objects.size(); i++)
                objects[i]->Draw(painter);