From 6f5ac2fbf69f019cc9d3a1522fc507c6b88d2bd6 Mon Sep 17 00:00:00 2001 From: tille Date: Sun, 12 May 2002 09:32:43 +0000 Subject: fixed mem leak --- (limited to 'noncore') diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 6de54ec..b92cbb0 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO @@ -1,6 +1,4 @@ * Settings Class -* tr() ;) -* Dialog to display ipkg output live * parse "to install" and "to remove" from status * install local file dialog * qcop @@ -11,5 +9,4 @@ * allow reinstalling * different types of filters and searches i.e. name, desc, files etc -* mark packages from doclnk and ipkgfind installed if installed -* show if different version is installed \ No newline at end of file +* display new list after update \ No newline at end of file diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 2fa91e3..19a1420 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -92,7 +92,8 @@ void MainWindow::makeMenu() menuBar->insertItem( tr( "Settings" ), cfgMenu ); // menuBar->insertItem( tr( "Sections" ), sectMenu ); - QLabel *spacer = new QLabel( "", toolBar ); + QLabel *spacer; +// spacer = new QLabel( "", toolBar ); // spacer->setBackgroundColor( toolBar->backgroundColor() ); // toolBar->setStretchableWidget( spacer ); 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 @@ -8,12 +8,14 @@ #include "debug.h" static QDict *packageListAll; +static int packageListAllRefCount = 0; PackageList::PackageList() : packageIter( packageList ) { empty=true; if (!packageListAll) packageListAll = new QDict(); + packageListAllRefCount++; sections << "All"; subSections.insert("All", new QStringList() ); QStringList *ss = subSections["All"]; @@ -31,6 +33,7 @@ PackageList::PackageList( PackageManagerSettings* s) PackageList::~PackageList() { + if (--packageListAllRefCount < 1 ) delete packageListAll; } /** Inserts a package into the list */ @@ -51,7 +54,7 @@ void PackageList::insertPackage( Package* pack ) // p->setName( pack->name()+"["+p->version()+"]" ); if (!packver) { - packver = new QDict; + packver = new QDict(); packver->insert( pack->name(), p ); p->setOtherVersions( packver ); } @@ -182,6 +185,7 @@ void PackageList::readFileEntries( QString filename, QString dest ) packEntry << line; }; } + delete statusStream; return; } diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index 1d10adf..f31f742 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp @@ -29,6 +29,7 @@ PackageListDocLnk::~PackageListDocLnk() Config cfg( "oipkg", Config::User ); cfg.setGroup( "Common" ); cfg.writeEntry( "docLnkDir", docLnkDir ); + delete doclnkset; } @@ -39,6 +40,6 @@ void PackageListDocLnk::update() QList packlist = doclnkset->children(); for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) { - insertPackage( new Package(pack->file(), settings) ); + insertPackage( new Package(pack->file(), settings ) ); } } diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp index ee54fca..e37f256 100644 --- a/noncore/unsupported/oipkg/packagelistremote.cpp +++ b/noncore/unsupported/oipkg/packagelistremote.cpp @@ -29,6 +29,7 @@ void PackageListRemote::query(QString s) void PackageListRemote::update() { pvDebug(2,"PackageListRemote::update"); + if (searchString.isEmpty()) return; int r=0; QString cmd = "wget"; QString redirect = "/tmp/oipkg.query"; diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index f2852c3..6ef6d19 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -51,7 +51,7 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) cmd += " -force-defaults "; - if (installDialog->_force_depends) + if (installDialog && installDialog->_force_depends) { if (installDialog->_force_depends->isChecked()) cmd += " -force-depends "; @@ -87,6 +87,7 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) if (lineStr!=lineStrOld) out(lineStr); lineStrOld = lineStr; + qApp->processEvents(); } pclose(fp); } @@ -156,6 +157,8 @@ void PmIpkg::processLinkDir( QString file, QString dest ) QString destFile = file; file = dest+"/"+file; if (file == dest) return; +// if (linkOpp==createLink) out( "\ncreating links\n" ); +// if (linkOpp==removeLink) out( "\nremoving links\n" ); QFileInfo fileInfo( file ); if ( fileInfo.isDir() ) { @@ -265,18 +268,18 @@ void PmIpkg::remove() runwindow->progress->setProgress( 1 ); linkOpp = removeLink; to_remove.at(i)->processed(); + if ( to_remove.at(i)->link() ) + processFileList( fileList, to_remove.at(i)->dest() ); to_remove.take( i ); - out("\n\n"); + out("\n"); }else{ out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); + if ( to_remove.at(i)->link() ) + processFileList( fileList, to_remove.at(i)->dest() ); } if ( to_remove.at(i)->link() ) - { - out( "\nremoving links\n" ); - out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); processFileList( fileList, to_remove.at(i)->dest() ); - } if ( to_remove.at(i)->link() )delete fileList; } to_remove.clear(); @@ -290,21 +293,21 @@ void PmIpkg::install() out(tr("Installing")+"\n"+tr("please wait")+"\n"); for (uint i=0; i < to_install.count(); i++) { + qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) { runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); to_install.at(i)->processed(); + linkOpp = createLink; + if ( to_install.at(i)->link() ) + makeLinks( to_install.at(i) ); to_install.take( i ); - out("\n\n"); + out("\n"); }else{ out(tr("Error while installing")+to_install.at(i)->name()+"\n"); - } - linkOpp = createLink; - if ( to_install.at(i)->link() ) - { - out( "\ncreating links\n" ); - out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" ); - makeLinks( to_install.at(i) ); + linkOpp = createLink; + if ( to_install.at(i)->link() ) + makeLinks( to_install.at(i) ); } } out("\n"); -- cgit v0.9.0.2