From adccbca61a174635a34eca86cefd4815138d17a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Wed, 3 Oct 2007 01:27:08 +0000 Subject: [PATCH] notify: unref the notification popup after we have finished using it. fix a big memory leak, and potential crashes. --- modules/misc/notify/notify.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/misc/notify/notify.c b/modules/misc/notify/notify.c index af017007f4..f8a56fbab0 100644 --- a/modules/misc/notify/notify.c +++ b/modules/misc/notify/notify.c @@ -80,7 +80,7 @@ static int Open( vlc_object_t *p_this ) intf_thread_t *p_intf = (intf_thread_t *)p_this; playlist_t *p_playlist; intf_sys_t *p_sys = malloc( sizeof( intf_sys_t ) ); - + if( !p_sys ) { msg_Err( p_intf, "Out of memory" ); @@ -118,6 +118,9 @@ static void Close( vlc_object_t *p_this ) var_DelCallback( p_playlist, "playlist-current", ItemChange, 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 ); free( p_sys ); notify_uninit(); @@ -266,7 +269,10 @@ static int Notify( vlc_object_t *p_this, const char *psz_temp, GdkPixbuf *pix, /* Close previous notification if still active */ if( p_intf->p_sys->notification ) + { notify_notification_close( p_intf->p_sys->notification, &p_error ); + g_object_unref( p_intf->p_sys->notification ); + } notification = notify_notification_new( _("Now Playing"), psz_temp, NULL, NULL); -- 2.20.1