X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fcontainer.cpp;h=a5653347ab325f97aa254897c4b25383af89e116;hb=d41ddd699001f6bbf6ac621f5c467bd13efb6087;hp=8a9c07bcc297a64193d7b8c98ee0b27e2de874c3;hpb=a14390c31519388a3e4f01bc53c0e4572708940c;p=architektonas diff --git a/src/container.cpp b/src/container.cpp index 8a9c07b..a565334 100644 --- a/src/container.cpp +++ b/src/container.cpp @@ -9,6 +9,8 @@ // 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,6 +25,12 @@ 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)