File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ GdkPixbuf * pixb;
1717
1818static ps_context * context ;
1919static ps_canvas * canvas ;
20+ static guint timer_id = 0 ;
2021
2122gboolean expose (GtkWidget * widget , GdkEventExpose * event )
2223{
@@ -32,6 +33,10 @@ gboolean expose (GtkWidget *widget, GdkEventExpose *event)
3233
3334void destroy (GtkWidget * widget , gpointer data )
3435{
36+ if (timer_id > 0 ) {
37+ g_source_remove (timer_id );
38+ timer_id = 0 ;
39+ }
3540 dini_context (context );
3641 ps_context_unref (context );
3742 ps_canvas_unref (canvas );
@@ -110,7 +115,7 @@ int main(int argc, char* argv[])
110115
111116 g_signal_connect (G_OBJECT (drawarea ), "expose_event" , G_CALLBACK (expose ), NULL );
112117
113- g_timeout_add (10 , time_func , GTK_WIDGET (drawarea ));
118+ timer_id = g_timeout_add (10 , time_func , GTK_WIDGET (drawarea ));
114119
115120 gtk_container_add (GTK_CONTAINER (window ), drawarea );
116121
You can’t perform that action at this time.
0 commit comments