Commit adccbca6 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

notify: unref the notification popup after we have finished using it. fix a...

notify: unref the notification popup after we have finished using it. fix a big memory leak, and potential crashes.
parent 59198c7d
...@@ -80,7 +80,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -80,7 +80,7 @@ static int Open( vlc_object_t *p_this )
intf_thread_t *p_intf = (intf_thread_t *)p_this; intf_thread_t *p_intf = (intf_thread_t *)p_this;
playlist_t *p_playlist; playlist_t *p_playlist;
intf_sys_t *p_sys = malloc( sizeof( intf_sys_t ) ); intf_sys_t *p_sys = malloc( sizeof( intf_sys_t ) );
if( !p_sys ) if( !p_sys )
{ {
msg_Err( p_intf, "Out of memory" ); msg_Err( p_intf, "Out of memory" );
...@@ -118,6 +118,9 @@ static void Close( vlc_object_t *p_this ) ...@@ -118,6 +118,9 @@ static void Close( vlc_object_t *p_this )
var_DelCallback( p_playlist, "playlist-current", ItemChange, p_this ); var_DelCallback( p_playlist, "playlist-current", ItemChange, p_this );
pl_Release( p_this ); pl_Release( p_this );
if( p_intf->p_sys->notification )
g_object_unref( p_intf->p_sys->notification );
vlc_mutex_destroy( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock );
free( p_sys ); free( p_sys );
notify_uninit(); notify_uninit();
...@@ -266,7 +269,10 @@ static int Notify( vlc_object_t *p_this, const char *psz_temp, GdkPixbuf *pix, ...@@ -266,7 +269,10 @@ static int Notify( vlc_object_t *p_this, const char *psz_temp, GdkPixbuf *pix,
/* Close previous notification if still active */ /* Close previous notification if still active */
if( p_intf->p_sys->notification ) if( p_intf->p_sys->notification )
{
notify_notification_close( p_intf->p_sys->notification, &p_error ); notify_notification_close( p_intf->p_sys->notification, &p_error );
g_object_unref( p_intf->p_sys->notification );
}
notification = notify_notification_new( _("Now Playing"), notification = notify_notification_new( _("Now Playing"),
psz_temp, NULL, NULL); psz_temp, NULL, NULL);
......
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