Re: Signals...



Hi,

Nuno Afonso <Nuno Afonso bigfoot com> writes:

> i have a button that is connected to a function called
> restartApp(GtkWidget *widget, Tabuleiro *tabuleiro) .
> 
> (Tabuleiro is a static cast of a drawing area).
> 
> When the button is clicked the restartApp is called
> and executes the following line
> 
> tabuleiro->paint();
> 
> the function paint() has the following content:
> void Tabuleiro::paint(){
> 	gdk_draw_rectangle(this->window, this->style->white_gc, true, 0, 0,
> 100, 100);
> 
> ...
> }
> 
> when i click the button i get segmentation fault when it tries to do the
> gdk_draw_rectangle. It gets in Tabuleiro::paint(), but it doesn't do the
> gdk_draw_rectangle.

Have you checked that your widget is realized when paint gets called?
this->window is NULL until the widget is realized. Try to add 

 if (!GTK_WIDGET_DRAWABLE (widget))
   return;

at the beginning of paint() to assure that the drawing code is only
executed if the widget is drawable.


Salut, Sven




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]