author | tille <tille> | 2002-05-12 09:32:43 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-12 09:32:43 (UTC) |
commit | 6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6 (patch) (side-by-side diff) | |
tree | c584a13cb4b70f007435731b63c0f0c5e6d5460c /noncore/unsupported/oipkg/packagelist.cpp | |
parent | 93eca505676b623407259bccf802e2069708dc36 (diff) | |
download | opie-6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6.zip opie-6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6.tar.gz opie-6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6.tar.bz2 |
fixed mem leak
Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 2fc4c41..fdd1163 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp @@ -5,18 +5,20 @@ #include <qfileinfo.h> #include <qtextstream.h> #include "debug.h" static QDict<Package> *packageListAll; +static int packageListAllRefCount = 0; PackageList::PackageList() : packageIter( packageList ) { empty=true; if (!packageListAll) packageListAll = new QDict<Package>(); + packageListAllRefCount++; sections << "All"; subSections.insert("All", new QStringList() ); QStringList *ss = subSections["All"]; *ss << "All"; aktSection = "All"; aktSubSection = "All"; @@ -28,12 +30,13 @@ PackageList::PackageList( PackageManagerSettings* s) settings = s; PackageList(); } PackageList::~PackageList() { + if (--packageListAllRefCount < 1 ) delete packageListAll; } /** Inserts a package into the list */ void PackageList::insertPackage( Package* pack ) { if (!pack) return; @@ -48,13 +51,13 @@ void PackageList::insertPackage( Package* pack ) pack = p; } else { QDict<Package> *packver = p->getOtherVersions(); // p->setName( pack->name()+"["+p->version()+"]" ); if (!packver) { - packver = new QDict<Package>; + packver = new QDict<Package>(); packver->insert( pack->name(), p ); p->setOtherVersions( packver ); } pack->setName( pack->name()+"["+pack->version()+"]" ); pack->setOtherVersions( packver ); packver->insert( pack->name(), pack ); @@ -179,12 +182,13 @@ void PackageList::readFileEntries( QString filename, QString dest ) } } }else{ packEntry << line; }; } + delete statusStream; return; } void PackageList::setSettings( PackageManagerSettings *s ) { settings = s; |