mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-16 12:57:27 +02:00
Fix cleanup of resources for UserLocations*
This commit is contained in:
parent
e7e7bef506
commit
a9e352981a
3 changed files with 8 additions and 1 deletions
|
@ -1187,7 +1187,7 @@ void Menu::namedLocationCreated(LocationManager::NamedLocationCreateResponse res
|
|||
|
||||
void Menu::toggleLocationList() {
|
||||
if (!_userLocationsWindow) {
|
||||
_userLocationsWindow = new UserLocationsWindow();
|
||||
_userLocationsWindow = new UserLocationsWindow(Application::getInstance()->getWindow());
|
||||
}
|
||||
if (_userLocationsWindow->isVisible()) {
|
||||
_userLocationsWindow->hide();
|
||||
|
|
|
@ -133,6 +133,11 @@ UserLocationsModel::UserLocationsModel(QObject* parent) :
|
|||
refresh();
|
||||
}
|
||||
|
||||
UserLocationsModel::~UserLocationsModel() {
|
||||
qDeleteAll(_locations);
|
||||
_locations.clear();
|
||||
}
|
||||
|
||||
void UserLocationsModel::update() {
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
|
@ -151,6 +156,7 @@ void UserLocationsModel::renameLocation(const QModelIndex& index, const QString&
|
|||
void UserLocationsModel::refresh() {
|
||||
if (!_updating) {
|
||||
beginResetModel();
|
||||
qDeleteAll(_locations);
|
||||
_locations.clear();
|
||||
_updating = true;
|
||||
endResetModel();
|
||||
|
|
|
@ -52,6 +52,7 @@ class UserLocationsModel : public QAbstractListModel {
|
|||
Q_OBJECT
|
||||
public:
|
||||
UserLocationsModel(QObject* parent = NULL);
|
||||
~UserLocationsModel();
|
||||
|
||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
|
|
Loading…
Reference in a new issue