(trunk gtk) remove a few very minor memory leaks in the GTK+ client

This commit is contained in:
Charles Kerr 2010-01-11 21:54:54 +00:00
parent fae3516d4b
commit fa94830df1
4 changed files with 16 additions and 4 deletions

View File

@ -2,4 +2,4 @@
export G_SLICE=always-malloc export G_SLICE=always-malloc
export G_DEBUG=gc-friendly export G_DEBUG=gc-friendly
export GLIBCXX_FORCE_NEW=1 export GLIBCXX_FORCE_NEW=1
valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=48 --log-file=x-valgrind --show-reachable=yes ./transmission -g /tmp/test valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=48 --log-file=x-valgrind --show-reachable=yes ./transmission

View File

@ -743,6 +743,17 @@ onLaunchClutchCB( GtkButton * w UNUSED,
g_free( url ); g_free( url );
} }
static void
remotePageFree( gpointer gpage )
{
struct remote_page * page = gpage;
g_slist_free( page->widgets );
g_slist_free( page->auth_widgets );
g_slist_free( page->whitelist_widgets );
g_free( page );
}
static GtkWidget* static GtkWidget*
webPage( GObject * core ) webPage( GObject * core )
{ {
@ -756,7 +767,7 @@ webPage( GObject * core )
page->core = TR_CORE( core ); page->core = TR_CORE( core );
t = hig_workarea_create( ); t = hig_workarea_create( );
g_object_set_data_full( G_OBJECT( t ), "page", page, g_free ); g_object_set_data_full( G_OBJECT( t ), "page", page, remotePageFree );
hig_workarea_add_section_title( t, &row, _( "Web Client" ) ); hig_workarea_add_section_title( t, &row, _( "Web Client" ) );

View File

@ -910,6 +910,7 @@ tr_window_new( GtkUIManager * ui_mgr, TrCore * core )
sexy_icon_entry_set_icon( SEXY_ICON_ENTRY( s ), sexy_icon_entry_set_icon( SEXY_ICON_ENTRY( s ),
SEXY_ICON_ENTRY_PRIMARY, SEXY_ICON_ENTRY_PRIMARY,
GTK_IMAGE( w ) ); GTK_IMAGE( w ) );
g_object_unref( w );
sexy_icon_entry_set_icon_highlight( SEXY_ICON_ENTRY( s ), sexy_icon_entry_set_icon_highlight( SEXY_ICON_ENTRY( s ),
SEXY_ICON_ENTRY_PRIMARY, TRUE ); SEXY_ICON_ENTRY_PRIMARY, TRUE );
#else #else

View File

@ -673,7 +673,7 @@ gtr_thread_func( gpointer data )
gdk_threads_leave( ); gdk_threads_leave( );
if( !more ) if( !more )
g_free( data ); g_slice_free( struct gtr_func_data, data );
return more; return more;
} }
@ -685,7 +685,7 @@ gtr_idle_add( GSourceFunc function, gpointer data )
#if GTK_CHECK_VERSION( 2,12,0 ) #if GTK_CHECK_VERSION( 2,12,0 )
gdk_threads_add_idle( function, data ); gdk_threads_add_idle( function, data );
#else #else
struct gtr_func_data * d = g_new( struct gtr_func_data, 1 ); struct gtr_func_data * d = g_slice_new( struct gtr_func_data );
d->function = function; d->function = function;
d->data = data; d->data = data;
g_idle_add( gtr_thread_func, d ); g_idle_add( gtr_thread_func, d );