mirror of
https://github.com/transmission/transmission
synced 2025-01-03 13:35:36 +00:00
(gtk) #998: gtk client crashes if you quit while the stats window is still up
This commit is contained in:
parent
db7b56e9f9
commit
dec4847b3f
1 changed files with 7 additions and 2 deletions
|
@ -76,6 +76,12 @@ updateStats( gpointer gdata )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
dialogDestroyed( gpointer p, GObject * dialog UNUSED )
|
||||
{
|
||||
g_source_remove( GPOINTER_TO_UINT( p ) );
|
||||
}
|
||||
|
||||
static void
|
||||
dialogResponse( GtkDialog * dialog, gint response, gpointer gdata )
|
||||
{
|
||||
|
@ -90,7 +96,6 @@ dialogResponse( GtkDialog * dialog, gint response, gpointer gdata )
|
|||
|
||||
if( response == GTK_RESPONSE_CLOSE )
|
||||
{
|
||||
g_source_remove( GPOINTER_TO_UINT( g_object_get_data( G_OBJECT(dialog), "TrTimer" ) ) );
|
||||
gtk_widget_destroy( GTK_WIDGET( dialog ) );
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +148,6 @@ stats_dialog_create( GtkWindow * parent, TrCore * core )
|
|||
g_object_set_data_full( G_OBJECT(d), "data", ui, g_free );
|
||||
g_signal_connect( d, "response", G_CALLBACK(dialogResponse), ui );
|
||||
i = g_timeout_add( 1000, updateStats, ui );
|
||||
g_object_set_data( G_OBJECT(d), "TrTimer", GUINT_TO_POINTER(i) );
|
||||
g_object_weak_ref( G_OBJECT( d ), dialogDestroyed, GUINT_TO_POINTER( i ) );
|
||||
return d;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue