aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp11
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.h4
2 files changed, 12 insertions, 3 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index 7726eed3..aad63a5e 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -517,6 +517,7 @@ void XDGDesktopList::watcherChanged(){
void XDGDesktopList::updateList(){
//run the check routine
if(synctimer->isActive()){ synctimer->stop(); }
+ hashmutex.lock();
QStringList appDirs = LXDG::systemApplicationDirs(); //get all system directories
QStringList found, newfiles; //for avoiding duplicate apps (might be files with same name in different priority directories)
QStringList oldkeys = files.keys();
@@ -569,10 +570,12 @@ void XDGDesktopList::updateList(){
synctimer->setInterval(60000); //Update in 1 minute if nothing changes before then
synctimer->start();
}
+ hashmutex.unlock();
}
QList<XDGDesktop*> XDGDesktopList::apps(bool showAll, bool showHidden){
//showAll: include invalid files, showHidden: include NoShow/Hidden files
+ //hashmutex.lock();
QStringList keys = files.keys();
QList<XDGDesktop*> out;
for(int i=0; i<keys.length(); i++){
@@ -582,17 +585,21 @@ QList<XDGDesktop*> XDGDesktopList::apps(bool showAll, bool showHidden){
}
}
}
+ //hashmutex.unlock();
return out;
}
XDGDesktop* XDGDesktopList::findAppFile(QString filename){
+ //hashmutex.lock();
QStringList keys = files.keys().filter(filename);
QString chk = filename.section("/",-1);
+ XDGDesktop *found = 0;
for(int i=0; i<keys.length(); i++){
- if(keys[i] == filename || keys[i].endsWith("/"+chk)){ return files[keys[i]]; }
+ if(keys[i] == filename || keys[i].endsWith("/"+chk)){ found = files[keys[i]]; }
}
+ //hashmutex.unlock();
//No matches
- return 0;
+ return found;
}
void XDGDesktopList::populateMenu(QMenu *topmenu, bool byCategory){
diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h
index 066f0462..c1e25b36 100644
--- a/src-qt5/core/libLumina/LuminaXDG.h
+++ b/src-qt5/core/libLumina/LuminaXDG.h
@@ -1,6 +1,6 @@
//===========================================
// Lumina-DE source code
-// Copyright (c) 2013, Ken Moore
+// Copyright (c) 2013-2019, Ken Moore
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
@@ -30,6 +30,7 @@
#include <QDebug>
#include <QMenu>
#include <QAction>
+#include <QMutex>
// ======================
// FreeDesktop Desktop Actions Framework (data structure)
@@ -117,6 +118,7 @@ private:
QFileSystemWatcher *watcher;
QTimer *synctimer;
bool keepsynced;
+ QMutex hashmutex;
private slots:
void watcherChanged();
bgstack15