diff options
author | Ken Moore <ken@pcbsd.org> | 2016-09-21 13:35:25 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2016-09-21 13:35:25 -0400 |
commit | 194547d321a327d6bea549a2aed047169973883b (patch) | |
tree | 50c870b48f3a0b28126ffe1c8a98e0e0264ec404 /src-qt5 | |
parent | Another quick fix to try and track down where Lumina is leaking memory within... (diff) | |
download | lumina-194547d321a327d6bea549a2aed047169973883b.tar.gz lumina-194547d321a327d6bea549a2aed047169973883b.tar.bz2 lumina-194547d321a327d6bea549a2aed047169973883b.zip |
Another small fix to try and correct the memory leak.
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index a32273c0..b57738c1 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -56,32 +56,34 @@ void XDGDesktopList::updateList(){ path = dir.absoluteFilePath(apps[a]); if(files.contains(path) && (files.value(path).lastRead>QFileInfo(path).lastModified()) ){ //Re-use previous data for this file (nothing changed) - dFile = files[path]; + found << files[path].name; //keep track of which files were already found ok=true; }else{ ok=false; + if(files.contains(path)){ files.remove(path); } dFile = LXDG::loadDesktopFile(path,ok); //will change the "ok" variable as needed appschanged = true; //flag that something changed - needed to load a file + if(ok && !found.contains(dFile.name)){ + if(!oldkeys.contains(path)){ newfiles << path; } //brand new file (not an update to a previously-read file) + files.insert(path, dFile); + found << dFile.name; + } } - if(ok && !found.contains(dFile.name)){ - if(!oldkeys.contains(path)){ newfiles << path; } //brand new file (not an update to a previously-read file) - else{ files.remove(path); } //just to ensure that we don't get duplicates within the Hash - files.insert(path, dFile); - found << dFile.name; - oldkeys.removeAll(path); //make sure this key does not get cleaned up later - } + oldkeys.removeAll(path); //make sure this key does not get cleaned up later } //end loop over apps } //end loop over appDirs //Save the extra info to the internal lists - if(!firstrun){ removedApps = oldkeys; }//files which were removed - if(!firstrun){ newApps = newfiles; }//files which were added + if(!firstrun){ + removedApps = oldkeys;//files which were removed + newApps = newfiles; //files which were added + } //Now go through and cleanup any old keys where the associated file does not exist anymore for(int i=0; i<oldkeys.length(); i++){ files.remove(oldkeys[i]); } //If this class is automatically managing the lists, update the watched files/dirs and send out notifications if(watcher!=0){ - qDebug() << "Auto App List Update:" << lastCheck << "Changes:" << appschanged;// << newfiles << oldkeys; + qDebug() << "Auto App List Update:" << lastCheck << "Changes:" << appschanged << "Files:" << files.count(); watcher->removePaths(QStringList() << watcher->files() << watcher->directories()); watcher->addPaths(appDirs); if(appschanged){ emit appsUpdated(); } |