Unified · Split
| @@ -1187,7 +1187,7 @@ void Menu::namedLocationCreated(LocationManager::NamedLocationCreateResponse res · 1186 unmodified lines | |||
| 1187 | 1187 | ||
| 1188 | void Menu::toggleLocationList() { | 1188 | void Menu::toggleLocationList() { |
| 1189 | if (!_userLocationsWindow) { | 1189 | if (!_userLocationsWindow) { |
| 1190 | _userLocationsWindow = new UserLocationsWindow(); | 1190 | _userLocationsWindow = new UserLocationsWindow(Application::getInstance()->getWindow()); |
| 1191 | } | 1191 | } |
| 1192 | if (_userLocationsWindow->isVisible()) { | 1192 | if (_userLocationsWindow->isVisible()) { |
| 1193 | _userLocationsWindow->hide(); | 1193 | _userLocationsWindow->hide(); |
| @@ -133,6 +133,11 @@ UserLocationsModel::UserLocationsModel(QObject* parent) : · 132 unmodified lines | |||
| 133 | refresh(); | 133 | refresh(); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | UserLocationsModel::~UserLocationsModel() { | ||
| 137 | qDeleteAll(_locations); | ||
| 138 | _locations.clear(); | ||
| 139 | } | ||
| 140 | |||
| 136 | void UserLocationsModel::update() { | 141 | void UserLocationsModel::update() { |
| 137 | beginResetModel(); | 142 | beginResetModel(); |
| 138 | endResetModel(); | 143 | endResetModel(); |
| @@ -151,6 +156,7 @@ void UserLocationsModel::renameLocation(const QModelIndex& index, const QString& · 12 unmodified lines | |||
| 151 | void UserLocationsModel::refresh() { | 156 | void UserLocationsModel::refresh() { |
| 152 | if (!_updating) { | 157 | if (!_updating) { |
| 153 | beginResetModel(); | 158 | beginResetModel(); |
| 159 | qDeleteAll(_locations); | ||
| 154 | _locations.clear(); | 160 | _locations.clear(); |
| 155 | _updating = true; | 161 | _updating = true; |
| 156 | endResetModel(); | 162 | endResetModel(); |
| @@ -52,6 +52,7 @@ class UserLocationsModel : public QAbstractListModel { · 51 unmodified lines | |||
| 52 | Q_OBJECT | 52 | Q_OBJECT |
| 53 | public: | 53 | public: |
| 54 | UserLocationsModel(QObject* parent = NULL); | 54 | UserLocationsModel(QObject* parent = NULL); |
| 55 | ~UserLocationsModel(); | ||
| 55 | 56 | ||
| 56 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; | 57 | virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; |
| 57 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; | 58 | virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; |