hi, thanks for replying after changing, segmentation fault still follows.
there's an additional error saying warning: passing arg 2 of `g_timeout_add' from incompatible pointer type in this case arg 2 is static gint real_draw ( GtkWidget * ) i figure the error occurred because it shd be static gint real_draw ( gpointer ) but still upon clicking the button, program terminates with segmentation error. what else could be the problem? thanks again for your help --- Olexiy Avramchenko <[EMAIL PROTECTED]> wrote: > Aaron Yang wrote: > > > void draw_button_clicked ( void ) > > { > 1. You're passing NULL as a parameter for timeout's > callback. > > g_timeout_add (100, real_draw, NULL); > > } > 2. window parameter is NULL (see above). > > static gint real_draw ( gpointer window ) > > { > > GtkWidget *widget; > 3. Variable widget is undefined, it can hold any > pointer. > > static int i=0; > > > 4. Here you're passing undefined variable to the > draw_brush call. > > draw_brush (widget, x[i], y[i]); > > i++; > > return TRUE; > > } > > Compile your program with -Wall gcc option and fix > all warnings from > compiler. > > To solve your problem you should do smth like this: > > void draw_button_clicked ( GtkWidget *button, > GtkWidget *drawing_area ) > { > g_timeout_add (100, real_draw, drawing_area); > } > > static gint real_draw ( GtkWidget *drawing_area ) > { > static int i=0; > > draw_brush (widget, x[i], y[i]); > i++; > return TRUE; > } > > Somewhere in code: > g_signal_connect (button, "clicked", > G_CALLBACK(draw_button_clicked), > drawing_area); > > Olexiy > > __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list