diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-25 12:40:48 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-25 12:40:48 -0500 |
commit | e9f29cfb2a76657f150ec585fa6775f372d7e460 (patch) | |
tree | 506d882cdfb752772313b95380de46a120ffc292 /kinit/autostart.cpp | |
parent | 5a5e7bae5334aea1f19b5df44b9e2fa65d7d952d (diff) | |
download | tdelibs-e9f29cfb2a76657f150ec585fa6775f372d7e460.tar.gz tdelibs-e9f29cfb2a76657f150ec585fa6775f372d7e460.zip |
Prevent XDG autostart files from starting multiple times
This resolves Bug 1096
Diffstat (limited to 'kinit/autostart.cpp')
-rw-r--r-- | kinit/autostart.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/kinit/autostart.cpp b/kinit/autostart.cpp index 488003948..c7feb1752 100644 --- a/kinit/autostart.cpp +++ b/kinit/autostart.cpp @@ -214,6 +214,32 @@ AutoStart::loadAutoStartList() } m_startList->append(item); } + + // Check for duplicate entries and remove if found + TQPtrListIterator<AutoStartItem> it1(*m_startList); + TQPtrListIterator<AutoStartItem> it2(*m_startList); + AutoStartItem *item1; + AutoStartItem *item2; + while ((item1 = it1.current()) != 0) { + bool dupfound1 = false; + it2.toFirst(); + while ((item2 = it2.current()) != 0) { + bool dupfound2 = false; + if (item2 != item1) { + if (item1->service == item2->service) { + m_startList->removeRef(item2); + dupfound1 = true; + dupfound2 = true; + } + } + if (!dupfound2) { + ++it2; + } + } + if (!dupfound1) { + ++it1; + } + } } TQString @@ -241,7 +267,7 @@ AutoStart::startService() } m_started.remove(m_started.begin()); } - + // Check for items that don't depend on anything AutoStartItem *item; for(item = m_startList->first(); |