# HG changeset patch # User Giacomo Lozito # Date 1186793412 -7200 # Node ID 161d289f335c5cb8c237b0eccdb959cb9f989b6a # Parent 68fab774c206490ac96161c5955a439e11f207d8 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 diff -r 68fab774c206 -r 161d289f335c src/mtp_up/mtp.c --- 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; + } }