Changeset 9762


Ignore:
Timestamp:
Dec 14, 2009, 7:24:05 PM (12 years ago)
Author:
charles
Message:

(trunk gtk) #2668 "minor memory leaks in gtk client" -- fix two GtkImages? that were being leaked in the main window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-window.c

    r9682 r9762  
    9696    GtkWidget *           stats_lb;
    9797    GtkWidget *           gutter_lb;
    98     GtkWidget *           alt_speed_image[2]; /* 0==off, 1==on */
     98    GtkWidget *           alt_speed_image;
    9999    GtkWidget *           alt_speed_button;
    100100    GtkWidget *           options_menu;
     
    285285{
    286286    PrivateData * p = vprivate;
    287 
    288287    g_signal_handler_disconnect( p->core, p->pref_handler_id );
    289     g_object_unref( G_OBJECT( p->alt_speed_image[1] ) );
    290     g_object_unref( G_OBJECT( p->alt_speed_image[0] ) );
    291288    g_free( p->filter_text );
    292289    g_free( p );
     
    336333    const char * fmt;
    337334    const gboolean b = pref_flag_get( TR_PREFS_KEY_ALT_SPEED_ENABLED );
     335    const char * stock = b ? "alt-speed-on" : "alt-speed-off";
    338336    GtkWidget * w = p->alt_speed_button;
    339337
     
    345343
    346344    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( w ), b );
    347     gtk_button_set_image( GTK_BUTTON( w ), p->alt_speed_image[b?1:0] );
     345    gtk_image_set_from_stock( GTK_IMAGE( p->alt_speed_image ), stock, -1 );
    348346    gtk_button_set_alignment( GTK_BUTTON( w ), 0.5, 0.5 );
    349347    gtr_widget_set_tooltip_text( w, str );
     
    960958        g_signal_connect( w, "clicked", G_CALLBACK(onOptionsClicked), p );
    961959
    962         p->alt_speed_image[0] = gtk_image_new_from_stock( "alt-speed-off", -1 );
    963         p->alt_speed_image[1] = gtk_image_new_from_stock( "alt-speed-on", -1 );
     960        p->alt_speed_image = gtk_image_new( );
    964961        w = p->alt_speed_button = gtk_toggle_button_new( );
     962        gtk_button_set_image( GTK_BUTTON( w ), p->alt_speed_image );
    965963        gtk_button_set_relief( GTK_BUTTON( w ), GTK_RELIEF_NONE );
    966         g_object_ref( G_OBJECT( p->alt_speed_image[0] ) );
    967         g_object_ref( G_OBJECT( p->alt_speed_image[1] ) );
    968         gtk_container_add( GTK_CONTAINER( w ), p->alt_speed_image[0] );
    969964        g_signal_connect( w, "toggled", G_CALLBACK(alt_speed_toggled_cb ), p );
    970965        gtk_box_pack_start( GTK_BOX( h ), w, 0, 0, 0 );
Note: See TracChangeset for help on using the changeset viewer.