Mercurial > audlegacy-plugins
changeset 1461:161d289f335c
do not assume that mtp_cleanup is only called after mtp_init (it's not true for general plugins); also, destroy the menuitem as it seems that it still holds a reference after being removed from its menushell
author | Giacomo Lozito <james@develia.org> |
---|---|
date | Sat, 11 Aug 2007 02:50:12 +0200 |
parents | 68fab774c206 |
children | 6edbd225b100 |
files | src/mtp_up/mtp.c |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mtp_up/mtp.c Fri Aug 10 19:36:01 2007 -0500 +++ b/src/mtp_up/mtp.c Sat Aug 11 02:50:12 2007 +0200 @@ -30,6 +30,8 @@ LIBMTP_file_t *filelist; Playlist *active_playlist; +static gboolean plugin_active = FALSE; + void mtp_init ( void ); void mtp_cleanup ( void ); void mtp_prefs ( void ); @@ -156,15 +158,21 @@ g_signal_connect (G_OBJECT (menuitem), "button_press_event",G_CALLBACK (mtp_press), NULL); LIBMTP_Init(); mutex = g_mutex_new(); + plugin_active = TRUE; } void mtp_cleanup(void) { + if (plugin_active) + { #if DEBUG - g_print("Cleaning up MTP_upload\n"); + g_print("Cleaning up MTP_upload\n"); #endif - audacious_menu_plugin_item_remove(AUDACIOUS_MENU_PLAYLIST, menuitem ); - g_mutex_free (mutex); - mutex = NULL; + audacious_menu_plugin_item_remove(AUDACIOUS_MENU_PLAYLIST_RCLICK, menuitem); + gtk_widget_destroy(menuitem); + g_mutex_free (mutex); + mutex = NULL; + plugin_active = FALSE; + } }