History

Fix cleanup of resources for UserLocations*

Ryan Huffman committed 12 years ago

Commit a9e35291 parent e7e7bef3 files · +8 −1Browse files

Showing the changes to interface/src/UserLocationsModel.cpp (1 of 3 files). Show all

Unified · Split

interface/src/UserLocationsModel.cpp+6−0
@@ -133,6 +133,11 @@ UserLocationsModel::UserLocationsModel(QObject* parent) : · 132 unmodified lines
133133 refresh();
134134 }
135135
136+UserLocationsModel::~UserLocationsModel() {
137+ qDeleteAll(_locations);
138+ _locations.clear();
139+}
140+
136141 void UserLocationsModel::update() {
137142 beginResetModel();
138143 endResetModel();
@@ -151,6 +156,7 @@ void UserLocationsModel::renameLocation(const QModelIndex& index, const QString& · 12 unmodified lines
151156 void UserLocationsModel::refresh() {
152157 if (!_updating) {
153158 beginResetModel();
159+ qDeleteAll(_locations);
154160 _locations.clear();
155161 _updating = true;
156162 endResetModel();