Skip to contentSkip to conversation

player: Fix clearing track metadata

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages Nov 22, 2017 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 player: Fix clearing track metadata

From: Luiz Augusto von Dentz <[email protected]>

The value stored in the hashtable is the path not the actual pointer of the item.

---
 profiles/audio/player.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
profiles/audio/player.c +3 -1
index e499e6757..d12969bf9 100644
@@ -1885,6 +1885,7 @@ struct media_item *media_player_set_playlist_item(struct media_player *mp,
 {
 	struct media_folder *folder = mp->playlist;
 	struct media_item *item;
+	char *path;
 
 	DBG("%" PRIu64 "", uid);
 
@@ -1903,7 +1904,8 @@ struct media_item *media_player_set_playlist_item(struct media_player *mp,
 		mp->track = g_hash_table_ref(item->metadata);
 	}
 
-	if (item == g_hash_table_lookup(mp->track, "Item"))
+	path = g_hash_table_lookup(mp->track, "Item");
+	if (!g_strcmp0(path, item->path))
 		return item;
 
 	if (mp->process_id == 0) {
Signature · 1 line
2.13.6
#1 lore raw
Quoted 14 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

The value stored in the hashtable is the path not the actual pointer of
the item.

---
 profiles/audio/player.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
profiles/audio/player.c +0 -0
index e499e6757..d12969bf9 100644

profiles/audio/player.c struct media_item · line 1889

Quoted 5 lines
profiles/audio/player.c +1 -0
@@ -1885,6 +1885,7 @@ struct media_item
 *media_player_set_playlist_item(struct media_player *mp,
 {
 	struct media_folder *folder = mp->playlist;
 	struct media_item *item;
+	char *path;

const char *? So it's clear why you don't free it.

Quoted 13 lines
profiles/audio/player.c +2 -1
 	DBG("%" PRIu64 "", uid);
 
@@ -1903,7 +1904,8 @@ struct media_item
 *media_player_set_playlist_item(struct media_player *mp,
 		mp->track = g_hash_table_ref(item->metadata);
 	}
 
-	if (item == g_hash_table_lookup(mp->track, "Item"))
+	path = g_hash_table_lookup(mp->track, "Item");
+	if (!g_strcmp0(path, item->path))
 		return item;
 

if (mp->process_id == 0) {

author maintainer
#2 lore raw

Hi Bastien,

Quoted 10 lines · Bastien Nocera
Quoted 9 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

The value stored in the hashtable is the path not the actual pointer of
the item.

---
 profiles/audio/player.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 12 lines

profiles/audio/player.c struct media_item · line 1889

Quoted 10 lines
profiles/audio/player.c +1 -0
index e499e6757..d12969bf9 100644
@@ -1885,6 +1885,7 @@ struct media_item
 *media_player_set_playlist_item(struct media_player *mp,
 {
      struct media_folder *folder = mp->playlist;
      struct media_item *item;
+     char *path;

const char *? So it's clear why you don't free it.

Sure.

Quoted 14 lines
Quoted 14 lines
profiles/audio/player.c +2 -1
      DBG("%" PRIu64 "", uid);
 
@@ -1903,7 +1904,8 @@ struct media_item
 *media_player_set_playlist_item(struct media_player *mp,
              mp->track = g_hash_table_ref(item->metadata);
      }
 
-     if (item == g_hash_table_lookup(mp->track, "Item"))
+     path = g_hash_table_lookup(mp->track, "Item");
+     if (!g_strcmp0(path, item->path))
              return item;
 
      if (mp->process_id == 0) {
Signature · 1 line
Luiz Augusto von Dentz