diff options
author | Ken Moore <ken@pcbsd.org> | 2014-10-22 09:46:32 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2014-10-22 09:46:32 -0400 |
commit | 6466d50172e68149eb465a3ba1be73df745bf0f6 (patch) | |
tree | c9742c0840e8ea9c895e3c7bd0bfdd13f46b460a | |
parent | Add randomization to the wallpaper image that is used on first start of a des... (diff) | |
download | lumina-6466d50172e68149eb465a3ba1be73df745bf0f6.tar.gz lumina-6466d50172e68149eb465a3ba1be73df745bf0f6.tar.bz2 lumina-6466d50172e68149eb465a3ba1be73df745bf0f6.zip |
Fix the system tray checking to once run one at a time (to prevent possible conflict with different loops modifying tray icons at the same time). This might fix the random desktop crashes since they seem to be tray related.
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.cpp | 18 | ||||
-rw-r--r-- | lumina-desktop/panel-plugins/systemtray/LSysTray.h | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp index 36f5f81d..1d1ebe67 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp @@ -34,7 +34,7 @@ LSysTray::LSysTray(QWidget *parent, QString id, bool horizontal) : LPPlugin(pare upTimer = new QTimer(this); upTimer->setInterval(300000); //maximum time between refreshes is 5 minutes connect(upTimer, SIGNAL(timeout()), this, SLOT(checkAll()) ); - isRunning = false; stopping = false; + isRunning = false; stopping = false; checking = false; QTimer::singleShot(100, this, SLOT(start()) ); connect(LSession::handle(), SIGNAL(TrayListChanged()), this, SLOT(checkAll()) ); @@ -166,12 +166,15 @@ void LSysTray::closeAll(){ } */ void LSysTray::checkAll(){ - if(!isRunning || stopping){ return; } //Don't check if not running at the moment + if(!isRunning || stopping || checking){ return; } //Don't check if not running at the moment + checking = true; + //qDebug() << "System Tray: Check tray apps"; QList<WId> wins = LSession::handle()->currentTrayApps(this->winId()); for(int i=0; i<trayIcons.length(); i++){ int index = wins.indexOf(trayIcons[i]->appID()); if(index < 0){ //Tray Icon no longer exists: remove it + //qDebug() << " - SysTray: Remove Icon"; TrayIcon *cont = trayIcons.takeAt(i); LI->removeWidget(cont); delete cont; @@ -184,12 +187,14 @@ void LSysTray::checkAll(){ } }else{ //Tray Icon already exists: just update it + //qDebug() << " - SysTray: Update Icon"; trayIcons[i]->update(); wins.removeAt(index); //Already found - remove from the list } } //Now go through any remaining windows and add them for(int i=0; i<wins.length(); i++){ + //qDebug() << " - SysTray: Add Icon"; TrayIcon *cont = new TrayIcon(this); LSession::processEvents(); trayIcons << cont; @@ -205,15 +210,18 @@ void LSysTray::checkAll(){ LSession::processEvents(); //qDebug() << " - Attach tray app"; cont->attachApp(wins[i]); - if(cont->appID()==0){ qDebug() << "Invalid Container:"; delete cont; continue; } //could not attach window + if(cont->appID()==0){ qDebug() << "Invalid Tray Container:"; delete cont; continue; } //could not attach window LI->update(); //make sure there is no blank space in the layout } + //qDebug() << " - System Tray: check done"; + checking = false; } void LSysTray::UpdateTrayWindow(WId win){ - if(!isRunning || stopping){ return; } + if(!isRunning || stopping || checking){ return; } for(int i=0; i<trayIcons.length(); i++){ - if(trayIcons[i]->appID()==win){ + if(trayIcons[i]->appID()==win){ + //qDebug() << "System Tray: Update Window " << win; trayIcons[i]->update(); break; } diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.h b/lumina-desktop/panel-plugins/systemtray/LSysTray.h index 7f8386fc..f45a52ad 100644 --- a/lumina-desktop/panel-plugins/systemtray/LSysTray.h +++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.h @@ -31,7 +31,7 @@ public: ~LSysTray(); private: - bool isRunning, stopping; + bool isRunning, stopping, checking; QList<TrayIcon*> trayIcons; QFrame *frame; QBoxLayout *LI; //layout items |