(trunk) fix a handful of small memory leaks that valgrind found.
This commit is contained in:
parent
bd88521332
commit
eb06d81fb9
|
@ -2385,6 +2385,7 @@ tracker_page_new( struct DetailsImpl * di )
|
|||
hbox = gtk_hbox_new( FALSE, GUI_PAD_BIG );
|
||||
|
||||
v = di->tracker_view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( di->trackers_filtered ) );
|
||||
g_object_unref( di->trackers_filtered );
|
||||
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( v ), FALSE );
|
||||
g_signal_connect( v, "button-press-event", G_CALLBACK( on_tree_view_button_pressed ), NULL );
|
||||
g_signal_connect( v, "button-release-event", G_CALLBACK( on_tree_view_button_released ), NULL );
|
||||
|
|
|
@ -580,6 +580,7 @@ gtr_file_list_set_torrent( GtkWidget * w, int torrentId )
|
|||
|
||||
gtk_tree_view_set_model( GTK_TREE_VIEW( data->view ), data->model );
|
||||
gtk_tree_view_expand_all( GTK_TREE_VIEW( data->view ) );
|
||||
g_object_unref( data->model );
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
39
gtk/filter.c
39
gtk/filter.c
|
@ -467,6 +467,13 @@ number_renderer_new( void )
|
|||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_cat_model_callbacks( gpointer tmodel, GObject * cat_model )
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func( tmodel, torrent_model_row_changed, cat_model );
|
||||
g_signal_handlers_disconnect_by_func( tmodel, torrent_model_row_deleted_cb, cat_model );
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
category_combo_box_new( GtkTreeModel * tmodel )
|
||||
{
|
||||
|
@ -477,6 +484,7 @@ category_combo_box_new( GtkTreeModel * tmodel )
|
|||
/* create the category combobox */
|
||||
cat_model = category_filter_model_new( tmodel );
|
||||
c = gtk_combo_box_new_with_model( cat_model );
|
||||
g_object_unref( cat_model );
|
||||
gtk_combo_box_set_row_separator_func( GTK_COMBO_BOX( c ),
|
||||
is_it_a_separator, NULL, NULL );
|
||||
gtk_combo_box_set_active( GTK_COMBO_BOX( c ), 0 );
|
||||
|
@ -504,12 +512,10 @@ category_combo_box_new( GtkTreeModel * tmodel )
|
|||
gtk_cell_layout_set_cell_data_func( GTK_CELL_LAYOUT( c ), r,
|
||||
render_number_func, NULL, NULL );
|
||||
|
||||
g_signal_connect( tmodel, "row-changed",
|
||||
G_CALLBACK( torrent_model_row_changed ), cat_model );
|
||||
g_signal_connect( tmodel, "row-inserted",
|
||||
G_CALLBACK( torrent_model_row_changed ), cat_model );
|
||||
g_signal_connect( tmodel, "row-deleted",
|
||||
G_CALLBACK( torrent_model_row_deleted_cb ), cat_model );
|
||||
g_object_weak_ref( G_OBJECT( cat_model ), disconnect_cat_model_callbacks, tmodel );
|
||||
g_signal_connect( tmodel, "row-changed", G_CALLBACK( torrent_model_row_changed ), cat_model );
|
||||
g_signal_connect( tmodel, "row-inserted", G_CALLBACK( torrent_model_row_changed ), cat_model );
|
||||
g_signal_connect( tmodel, "row-deleted", G_CALLBACK( torrent_model_row_deleted_cb ), cat_model );
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -793,6 +799,13 @@ activity_torrent_model_row_deleted_cb( GtkTreeModel * tmodel UNUSED,
|
|||
activity_model_update_idle( activity_model );
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_activity_model_callbacks( gpointer tmodel, GObject * cat_model )
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func( tmodel, activity_torrent_model_row_changed, cat_model );
|
||||
g_signal_handlers_disconnect_by_func( tmodel, activity_torrent_model_row_deleted_cb, cat_model );
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
activity_combo_box_new( GtkTreeModel * tmodel )
|
||||
{
|
||||
|
@ -802,6 +815,7 @@ activity_combo_box_new( GtkTreeModel * tmodel )
|
|||
|
||||
activity_model = activity_filter_model_new( tmodel );
|
||||
c = gtk_combo_box_new_with_model( activity_model );
|
||||
g_object_unref( activity_model );
|
||||
gtk_combo_box_set_row_separator_func( GTK_COMBO_BOX( c ),
|
||||
activity_is_it_a_separator, NULL, NULL );
|
||||
gtk_combo_box_set_active( GTK_COMBO_BOX( c ), 0 );
|
||||
|
@ -825,15 +839,10 @@ activity_combo_box_new( GtkTreeModel * tmodel )
|
|||
gtk_cell_layout_set_cell_data_func( GTK_CELL_LAYOUT( c ), r,
|
||||
render_number_func, NULL, NULL );
|
||||
|
||||
g_signal_connect( tmodel, "row-changed",
|
||||
G_CALLBACK( activity_torrent_model_row_changed ),
|
||||
activity_model );
|
||||
g_signal_connect( tmodel, "row-inserted",
|
||||
G_CALLBACK( activity_torrent_model_row_changed ),
|
||||
activity_model );
|
||||
g_signal_connect( tmodel, "row-deleted",
|
||||
G_CALLBACK( activity_torrent_model_row_deleted_cb ),
|
||||
activity_model );
|
||||
g_object_weak_ref( G_OBJECT( activity_model ), disconnect_activity_model_callbacks, tmodel );
|
||||
g_signal_connect( tmodel, "row-changed", G_CALLBACK( activity_torrent_model_row_changed ), activity_model );
|
||||
g_signal_connect( tmodel, "row-inserted", G_CALLBACK( activity_torrent_model_row_changed ), activity_model );
|
||||
g_signal_connect( tmodel, "row-deleted", G_CALLBACK( activity_torrent_model_row_deleted_cb ), activity_model );
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -1103,6 +1103,8 @@ on_drag_data_received( GtkWidget * widget UNUSED,
|
|||
gtr_core_add_from_url( data->core, uri );
|
||||
success = TRUE;
|
||||
}
|
||||
|
||||
g_free( filename );
|
||||
}
|
||||
|
||||
if( files )
|
||||
|
|
|
@ -506,6 +506,7 @@ gtr_message_log_window_new( GtkWindow * parent, TrCore * core )
|
|||
data->filter = gtk_tree_model_filter_new( GTK_TREE_MODEL(
|
||||
data->store ), NULL );
|
||||
data->sort = gtk_tree_model_sort_new_with_model( data->filter );
|
||||
g_object_unref( data->filter );
|
||||
gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE( data->sort ),
|
||||
COL_SEQUENCE,
|
||||
GTK_SORT_ASCENDING );
|
||||
|
@ -516,6 +517,7 @@ gtr_message_log_window_new( GtkWindow * parent, TrCore * core )
|
|||
|
||||
|
||||
view = gtk_tree_view_new_with_model( data->sort );
|
||||
g_object_unref( data->sort );
|
||||
g_signal_connect( view, "button-release-event",
|
||||
G_CALLBACK( on_tree_view_button_released ), NULL );
|
||||
data->view = GTK_TREE_VIEW( view );
|
||||
|
|
|
@ -249,6 +249,7 @@ core_init( GTypeInstance * instance, gpointer g_class UNUSED )
|
|||
|
||||
p->raw_model = GTK_TREE_MODEL( store );
|
||||
p->sorted_model = gtk_tree_model_sort_new_with_model( p->raw_model );
|
||||
g_object_unref( p->raw_model );
|
||||
|
||||
#ifdef HAVE_DBUS_GLIB
|
||||
if( our_instance_adds_remote_torrents )
|
||||
|
|
|
@ -157,6 +157,7 @@ makeview( PrivateData * p )
|
|||
|
||||
|
||||
gtk_tree_view_set_model( GTK_TREE_VIEW( view ), p->filter_model );
|
||||
g_object_unref( p->filter_model );
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -121,6 +121,7 @@ tr_ctorSetMetainfoFromMagnetLink( tr_ctor * ctor, const char * magnet_link )
|
|||
err = tr_ctorSetMetainfo( ctor, (const uint8_t*)str, len );
|
||||
|
||||
tr_free( str );
|
||||
tr_bencFree( &tmp );
|
||||
tr_magnetFree( magnet_info );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue