1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-01 20:11:59 +00:00

(gtk) quick fix for the memory corruption bug reported by werehamster

This commit is contained in:
Charles Kerr 2007-12-19 12:38:36 +00:00
parent ae682b59be
commit 4744c7f8a4
2 changed files with 8 additions and 8 deletions

View file

@ -31,19 +31,20 @@ struct stat_ui
};
static void
setLabel( GtkWidget * w, char * ownme )
setLabel( GtkWidget * w, const char * str )
{
gtk_label_set_text( GTK_LABEL(w), ownme );
g_free( ownme );
gtk_label_set_text( GTK_LABEL(w), str );
}
static void
setLabelFromRatio( GtkWidget * w, double d )
{
char * str = ( (int)d == TR_RATIO_NA )
? g_strdup_printf( _("None" ) )
: g_strdup_printf( "%.1f%%", d );
setLabel( w, str );
char buf[128];
if( ( (int)d == TR_RATIO_NA ) )
g_strlcpy( buf, _("None"), sizeof(buf) );
else
g_snprintf( buf, sizeof(buf), "%.1f", d );
setLabel( w, buf );
}
static gboolean

View file

@ -163,7 +163,6 @@ tr_window_new( GtkUIManager * ui_manager )
gtk_widget_set_usize (w, 0u, 6u);
gtk_box_pack_start( GTK_BOX(vbox), w, FALSE, FALSE, 0 );
/* statusbar */
h = gtk_hbox_new( FALSE, 0 );
w = p->ul_lb = gtk_label_new( NULL );