Changeset 12234


Ignore:
Timestamp:
Mar 25, 2011, 5:42:47 PM (11 years ago)
Author:
jordan
Message:

(trunk) fix a handful of small memory leaks that valgrind found.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r12223 r12234  
    23862386
    23872387        v = di->tracker_view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( di->trackers_filtered ) );
     2388        g_object_unref( di->trackers_filtered );
    23882389        gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( v ), FALSE );
    23892390        g_signal_connect( v, "button-press-event", G_CALLBACK( on_tree_view_button_pressed ), NULL );
  • trunk/gtk/file-list.c

    r12223 r12234  
    581581    gtk_tree_view_set_model( GTK_TREE_VIEW( data->view ), data->model );
    582582    gtk_tree_view_expand_all( GTK_TREE_VIEW( data->view ) );
     583    g_object_unref( data->model );
    583584}
    584585
  • trunk/gtk/filter.c

    r12177 r12234  
    468468}
    469469
     470static void
     471disconnect_cat_model_callbacks( gpointer tmodel, GObject * cat_model )
     472{
     473    g_signal_handlers_disconnect_by_func( tmodel, torrent_model_row_changed, cat_model );
     474    g_signal_handlers_disconnect_by_func( tmodel, torrent_model_row_deleted_cb, cat_model );
     475}
     476
    470477static GtkWidget *
    471478category_combo_box_new( GtkTreeModel * tmodel )
     
    478485    cat_model = category_filter_model_new( tmodel );
    479486    c = gtk_combo_box_new_with_model( cat_model );
     487    g_object_unref( cat_model );
    480488    gtk_combo_box_set_row_separator_func( GTK_COMBO_BOX( c ),
    481489                                          is_it_a_separator, NULL, NULL );
     
    505513                                        render_number_func, NULL, NULL );
    506514
    507     g_signal_connect( tmodel, "row-changed",
    508                       G_CALLBACK( torrent_model_row_changed ), cat_model );
    509     g_signal_connect( tmodel, "row-inserted",
    510                       G_CALLBACK( torrent_model_row_changed ), cat_model );
    511     g_signal_connect( tmodel, "row-deleted",
    512                       G_CALLBACK( torrent_model_row_deleted_cb ), cat_model );
     515    g_object_weak_ref( G_OBJECT( cat_model ), disconnect_cat_model_callbacks, tmodel );
     516    g_signal_connect( tmodel, "row-changed", G_CALLBACK( torrent_model_row_changed ), cat_model );
     517    g_signal_connect( tmodel, "row-inserted", G_CALLBACK( torrent_model_row_changed ), cat_model );
     518    g_signal_connect( tmodel, "row-deleted", G_CALLBACK( torrent_model_row_deleted_cb ), cat_model );
    513519
    514520    return c;
     
    794800}
    795801
     802static void
     803disconnect_activity_model_callbacks( gpointer tmodel, GObject * cat_model )
     804{
     805    g_signal_handlers_disconnect_by_func( tmodel, activity_torrent_model_row_changed, cat_model );
     806    g_signal_handlers_disconnect_by_func( tmodel, activity_torrent_model_row_deleted_cb, cat_model );
     807}
     808
    796809static GtkWidget *
    797810activity_combo_box_new( GtkTreeModel * tmodel )
     
    803816    activity_model = activity_filter_model_new( tmodel );
    804817    c = gtk_combo_box_new_with_model( activity_model );
     818    g_object_unref( activity_model );
    805819    gtk_combo_box_set_row_separator_func( GTK_COMBO_BOX( c ),
    806820                                       activity_is_it_a_separator, NULL, NULL );
     
    826840                                        render_number_func, NULL, NULL );
    827841
    828     g_signal_connect( tmodel, "row-changed",
    829                       G_CALLBACK( activity_torrent_model_row_changed ),
    830                       activity_model );
    831     g_signal_connect( tmodel, "row-inserted",
    832                       G_CALLBACK( activity_torrent_model_row_changed ),
    833                       activity_model );
    834     g_signal_connect( tmodel, "row-deleted",
    835                       G_CALLBACK( activity_torrent_model_row_deleted_cb ),
    836                       activity_model );
     842    g_object_weak_ref( G_OBJECT( activity_model ), disconnect_activity_model_callbacks, tmodel );
     843    g_signal_connect( tmodel, "row-changed", G_CALLBACK( activity_torrent_model_row_changed ), activity_model );
     844    g_signal_connect( tmodel, "row-inserted", G_CALLBACK( activity_torrent_model_row_changed ), activity_model );
     845    g_signal_connect( tmodel, "row-deleted", G_CALLBACK( activity_torrent_model_row_deleted_cb ), activity_model );
    837846
    838847    return c;
  • trunk/gtk/main.c

    r12232 r12234  
    11041104            success = TRUE;
    11051105        }
     1106
     1107        g_free( filename );
    11061108    }
    11071109
  • trunk/gtk/msgwin.c

    r12221 r12234  
    507507                                                  data->store ), NULL );
    508508    data->sort = gtk_tree_model_sort_new_with_model( data->filter );
     509    g_object_unref( data->filter );
    509510    gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE( data->sort ),
    510511                                          COL_SEQUENCE,
     
    517518
    518519    view = gtk_tree_view_new_with_model( data->sort );
     520    g_object_unref( data->sort );
    519521    g_signal_connect( view, "button-release-event",
    520522                      G_CALLBACK( on_tree_view_button_released ), NULL );
  • trunk/gtk/tr-core.c

    r12222 r12234  
    250250    p->raw_model = GTK_TREE_MODEL( store );
    251251    p->sorted_model = gtk_tree_model_sort_new_with_model( p->raw_model );
     252    g_object_unref( p->raw_model );
    252253
    253254#ifdef HAVE_DBUS_GLIB
  • trunk/gtk/tr-window.c

    r12232 r12234  
    158158
    159159    gtk_tree_view_set_model( GTK_TREE_VIEW( view ), p->filter_model );
     160    g_object_unref( p->filter_model );
    160161
    161162    return view;
  • trunk/libtransmission/torrent-ctor.c

    r12228 r12234  
    122122
    123123        tr_free( str );
     124        tr_bencFree( &tmp );
    124125        tr_magnetFree( magnet_info );
    125126    }
Note: See TracChangeset for help on using the changeset viewer.