Commit c04d8671 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: fix input item now playing

This fixes a memory leak, encoding problems, and complete failure on
non-file inputs.
parent 31d1aa76
...@@ -461,18 +461,23 @@ void InputManager::UpdateName() ...@@ -461,18 +461,23 @@ void InputManager::UpdateName()
/* Try to get the nowplaying */ /* Try to get the nowplaying */
char *format = var_InheritString( p_intf, "input-title-format" ); char *format = var_InheritString( p_intf, "input-title-format" );
char *formated = str_format_meta( p_input, format ); char *formated = str_format_meta( p_input, format );
name = formated;
/* Free everything */
free( format ); free( format );
name = qfu(formated);
free( formated ); free( formated );
/* If we have Nothing */ /* If we have Nothing */
if( name.isEmpty() ) if( name.isEmpty() )
{ {
char *psz_name = make_path( input_item_GetURI( input_GetItem( p_input ) ) ); char *uri = input_item_GetURI( input_GetItem( p_input ) );
name = psz_name; char *file = uri ? strrchr( uri, '/' ) : NULL;
name = name.remove( 0, name.lastIndexOf( DIR_SEP ) + 1 ); if( file != NULL )
free( psz_name ); {
decode_URI( ++file );
name = qfu(file);
}
else
name = qfu(uri);
free( uri );
} }
name = name.trimmed(); name = name.trimmed();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment