Re: Crashing closing windows




Shevek <shevek@plaice.valhalla.net> writes:

>     window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>     gtk_window_set_title(GTK_WINDOW (window), "Day display (needs date)");
>     gtk_signal_connect (GTK_OBJECT (window), "destroy",
>                     GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
                                                               ^^^^^^

Is window by any chance a stack variable?

gtk_widget_destroyed is a very simple convenience function. 

========
void
gtk_widget_destroyed (GtkWidget      *widget,
		      GtkWidget      **widget_pointer)
{
  if (widget_pointer)
    *widget_pointer = NULL;
}
========

Only connect it like that if you want window to be zeroed when
the window is destroyed. If "window" is a stack variable, you
almost certainly don't want that to happen.

When the window is closed, most likely there is some important
part of a calling function's stack where 'window' used to
be.

Regards,
                                        Owen



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