Commit 6e87542d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Remove weird use of QList on the heap

parent 853333c2
...@@ -35,14 +35,11 @@ public: ...@@ -35,14 +35,11 @@ public:
AutoStart::AutoStart() AutoStart::AutoStart()
: m_phase(-1), m_phasedone(false) : m_phase(-1), m_phasedone(false)
{ {
m_startList = new AutoStartList;
} }
AutoStart::~AutoStart() AutoStart::~AutoStart()
{ {
qDeleteAll(*m_startList); qDeleteAll(m_startList);
m_startList->clear();
delete m_startList;
} }
void void
...@@ -104,14 +101,14 @@ AutoStart::loadAutoStartList() ...@@ -104,14 +101,14 @@ AutoStart::loadAutoStartList()
if (item->phase < 0) { if (item->phase < 0) {
item->phase = 0; item->phase = 0;
} }
m_startList->append(item); m_startList.append(item);
} }
} }
QString QString
AutoStart::startService() AutoStart::startService()
{ {
if (m_startList->isEmpty()) { if (m_startList.isEmpty()) {
return QString(); return QString();
} }
...@@ -119,7 +116,7 @@ AutoStart::startService() ...@@ -119,7 +116,7 @@ AutoStart::startService()
// Check for items that depend on previously started items // Check for items that depend on previously started items
QString lastItem = m_started[0]; QString lastItem = m_started[0];
QMutableListIterator<AutoStartItem *> it(*m_startList); QMutableListIterator<AutoStartItem *> it(m_startList);
while (it.hasNext()) { while (it.hasNext()) {
AutoStartItem *item = it.next(); AutoStartItem *item = it.next();
if (item->phase == m_phase if (item->phase == m_phase
...@@ -136,7 +133,7 @@ AutoStart::startService() ...@@ -136,7 +133,7 @@ AutoStart::startService()
// Check for items that don't depend on anything // Check for items that don't depend on anything
AutoStartItem *item; AutoStartItem *item;
QMutableListIterator<AutoStartItem *> it(*m_startList); QMutableListIterator<AutoStartItem *> it(m_startList);
while (it.hasNext()) { while (it.hasNext()) {
item = it.next(); item = it.next();
if (item->phase == m_phase if (item->phase == m_phase
...@@ -150,7 +147,7 @@ AutoStart::startService() ...@@ -150,7 +147,7 @@ AutoStart::startService()
} }
// Just start something in this phase // Just start something in this phase
it = *m_startList; it = m_startList;
while (it.hasNext()) { while (it.hasNext()) {
item = it.next(); item = it.next();
if (item->phase == m_phase) { if (item->phase == m_phase) {
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <QtCore/QStringList> #include <QtCore/QStringList>
class AutoStartItem; class AutoStartItem;
typedef QList<AutoStartItem *> AutoStartList;
class AutoStart class AutoStart
{ {
...@@ -45,7 +44,7 @@ public: ...@@ -45,7 +44,7 @@ public:
} }
private: private:
AutoStartList *m_startList; QList<AutoStartItem *> m_startList;
QStringList m_started; QStringList m_started;
int m_phase; int m_phase;
bool m_phasedone; bool m_phasedone;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment