diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-25 12:40:48 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-08-04 16:24:03 +0200 |
commit | f75b05bac9bbafad8f6d21312f4b52b042e3a0dd (patch) | |
tree | d6cb4d53eeac3a548c3272cf4a1db3968bc09d9d | |
parent | 27939e15c41c3ea4a3be4c2f18e189fa84b2dfbf (diff) | |
download | tdelibs-f75b05bac9bbafad8f6d21312f4b52b042e3a0dd.tar.gz tdelibs-f75b05bac9bbafad8f6d21312f4b52b042e3a0dd.zip |
Prevent XDG autostart files from starting multiple times
This resolves Bug 1096
(cherry picked from commit e9f29cfb2a76657f150ec585fa6775f372d7e460)
-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 334bfa543..48325f29c 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(); |