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:
AutoStart::AutoStart()
: m_phase(-1), m_phasedone(false)
{
m_startList = new AutoStartList;
}
AutoStart::~AutoStart()
{
qDeleteAll(*m_startList);
m_startList->clear();
delete m_startList;
qDeleteAll(m_startList);
}
void
......@@ -104,14 +101,14 @@ AutoStart::loadAutoStartList()
if (item->phase < 0) {
item->phase = 0;
}
m_startList->append(item);
m_startList.append(item);
}
}
QString
AutoStart::startService()
{
if (m_startList->isEmpty()) {
if (m_startList.isEmpty()) {
return QString();
}
......@@ -119,7 +116,7 @@ AutoStart::startService()
// Check for items that depend on previously started items
QString lastItem = m_started[0];
QMutableListIterator<AutoStartItem *> it(*m_startList);
QMutableListIterator<AutoStartItem *> it(m_startList);
while (it.hasNext()) {
AutoStartItem *item = it.next();
if (item->phase == m_phase
......@@ -136,7 +133,7 @@ AutoStart::startService()
// Check for items that don't depend on anything
AutoStartItem *item;
QMutableListIterator<AutoStartItem *> it(*m_startList);
QMutableListIterator<AutoStartItem *> it(m_startList);
while (it.hasNext()) {
item = it.next();
if (item->phase == m_phase
......@@ -150,7 +147,7 @@ AutoStart::startService()
}
// Just start something in this phase
it = *m_startList;
it = m_startList;
while (it.hasNext()) {
item = it.next();
if (item->phase == m_phase) {
......
......@@ -23,7 +23,6 @@
#include <QtCore/QStringList>
class AutoStartItem;
typedef QList<AutoStartItem *> AutoStartList;
class AutoStart
{
......@@ -45,7 +44,7 @@ public:
}
private:
AutoStartList *m_startList;
QList<AutoStartItem *> m_startList;
QStringList m_started;
int m_phase;
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