Code Cleanup: GcCalendarModel

.. wow, nasty memory leak fixed. Leaked memory every
time a ride was selected or calendar was refreshed!

.. tbf it was marked with a 'XXX' memory leak comment
but really lazy to leave it there.

.. was also highlighted by valgrind, which is promising,
since I've been using it to hunt down any memory managment
issues -- most of them are within 3rd party libraries tho.
This commit is contained in:
Mark Liversedge
2013-02-11 09:05:19 +00:00
parent 7cf419a204
commit 5a6477d7a3

View File

@@ -101,7 +101,15 @@ public slots:
// we need to build a list of all the rides
// in the source model for the dates we have
dateToRows.clear(); //XXX mem leak, need to delete vectors...
// first we clear previous
QMapIterator<QDate, QVector<int>* > fm(dateToRows);
while (fm.hasNext()) {
fm.next();
delete fm.value();
}
dateToRows.clear();
// then we create new
for (int j=0; j<sourceModel()->rowCount(); j++) {
QVector<int> *arr;