summaryrefslogtreecommitdiffstats
path: root/src/library/traktor/traktorfeature.cpp
diff options
context:
space:
mode:
authorUwe Klotz <uwe_klotz@web.de>2016-12-08 23:19:16 +0100
committerUwe Klotz <uwe_klotz@web.de>2016-12-09 23:45:42 +0100
commit9eb92d0f3b52316ddd2e34e84c94ca44b58ac3fe (patch)
tree94feccb1aca633c08c90ff0299173173019cf636 /src/library/traktor/traktorfeature.cpp
parent7d2e0fce392413c7a4f4292ccc0dd5e5f45f496f (diff)
Simplify and safeguard memory management of TreeItem(Model)
Diffstat (limited to 'src/library/traktor/traktorfeature.cpp')
-rw-r--r--src/library/traktor/traktorfeature.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/traktor/traktorfeature.cpp b/src/library/traktor/traktorfeature.cpp
index a0c461d90c..09a045e435 100644
--- a/src/library/traktor/traktorfeature.cpp
+++ b/src/library/traktor/traktorfeature.cpp
@@ -410,14 +410,14 @@ TreeItem* TraktorFeature::parsePlaylists(QXmlStreamReader &xml) {
current_path += name;
//qDebug() << "Folder: " +current_path << " has parent " << parent->getData().toString();
map.insert(current_path, "FOLDER");
- parent = parent->appendChild(new TreeItem(this, name, current_path));
+ parent = parent->appendChild(name, current_path);
} else if (type == "PLAYLIST") {
current_path += delimiter;
current_path += name;
//qDebug() << "Playlist: " +current_path << " has parent " << parent->getData().toString();
map.insert(current_path, "PLAYLIST");
- parent->appendChild(new TreeItem(this, name, current_path));
+ parent->appendChild(name, current_path);
// process all the entries within the playlist 'name' having path 'current_path'
parsePlaylistEntries(xml, current_path,
query_insert_to_playlists,
@@ -598,9 +598,9 @@ QString TraktorFeature::getTraktorMusicDatabase() {
}
void TraktorFeature::onTrackCollectionLoaded() {
- TreeItem* root = m_future.result();
+ std::unique_ptr<TreeItem> root(m_future.result());
if (root) {
- m_childModel.setRootItem(root);
+ m_childModel.setRootItem(std::move(root));
// Tell the traktor track source that it should re-build its index.
m_trackSource->buildIndex();