linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] player: Fix clearing track metadata
@ 2017-11-22 13:34 Luiz Augusto von Dentz
  2017-11-22 13:36 ` Bastien Nocera
  0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2017-11-22 13:34 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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(-)

diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index e499e6757..d12969bf9 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -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) {
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] player: Fix clearing track metadata
  2017-11-22 13:34 [PATCH BlueZ] player: Fix clearing track metadata Luiz Augusto von Dentz
@ 2017-11-22 13:36 ` Bastien Nocera
  2017-11-22 13:41   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien Nocera @ 2017-11-22 13:36 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth

On Wed, 2017-11-22 at 15:34 +0200, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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(-)
> 
> diff --git a/profiles/audio/player.c b/profiles/audio/player.c
> index e499e6757..d12969bf9 100644
> --- a/profiles/audio/player.c
> +++ b/profiles/audio/player.c
> @@ -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.

>  	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) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] player: Fix clearing track metadata
  2017-11-22 13:36 ` Bastien Nocera
@ 2017-11-22 13:41   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2017-11-22 13:41 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: linux-bluetooth@vger.kernel.org

Hi Bastien,

On Wed, Nov 22, 2017 at 3:36 PM, Bastien Nocera <hadess@hadess.net> wrote:
> On Wed, 2017-11-22 at 15:34 +0200, Luiz Augusto von Dentz wrote:
>> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>>
>> 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(-)
>>
>> diff --git a/profiles/audio/player.c b/profiles/audio/player.c
>> index e499e6757..d12969bf9 100644
>> --- a/profiles/audio/player.c
>> +++ b/profiles/audio/player.c
>> @@ -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.

>
>>       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) {


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-22 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22 13:34 [PATCH BlueZ] player: Fix clearing track metadata Luiz Augusto von Dentz
2017-11-22 13:36 ` Bastien Nocera
2017-11-22 13:41   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).