Re: [gtk-list] Found: Shortest way to trigger core-dump :-(
- From: Andreas Tille <tille physik uni-halle de>
- To: Bertrand Guiheneuf inria fr
- cc: gtk-list redhat com
- Subject: Re: [gtk-list] Found: Shortest way to trigger core-dump :-(
- Date: Wed, 21 Apr 1999 22:09:01 +0200 (METDST)
On Wed, 21 Apr 1999 Bertrand.Guiheneuf@inria.fr wrote:
> static void Function(void *data, GtkSignalFunc func, char *question)
> {
> GtkWidget *window, *button;
>
> window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window);
>
> &window is a pointer to somerthing in the stack....
>
> put GtkWidget *window, *button; outside you r function, this
> will resolve youe segmentation fault.
Why shouldn't I use internal variables in this case?
I really didn't see any reason and I want to avoid global variables
because I consider it to be bad style.
OK, it would solve the Problem, but declaring the variables static would
solve the problem, too.
But could you explain, why for instance this
static void MainCallback(GtkWidget *button, char *dummy)
{
char *file, *buf;
file = g_strdup("");
/* buf = g_strdup(""); */
Function(file, GTK_SIGNAL_FUNC(Callback), NULL);
/* if ( buf ) g_free(buf); */
}
solves the problem as well??? What has this really unneeded pointer
to do with *window and *button??
There are several ways to get rid of the segmentation fault, but no
one makes me really clear why it occures. In my opinion the use
of local variables in Function() is valid.
Kind regards
Andreas.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]