Re: sigsegv caught when I click a button.




Michael Oswell writes:
>Hi.. I appear to be having a problem with the button in gtk.  I only
>started programming with it about two days ago, and for seom reason,
>whenever I click on a button, it sigsegv's.  I've attached the code
>and the machine that I am running on... Any help would be greatly
>appreciated.

I think I found your problem.  I thought I saw a similar problem here
a few days ago...

>void new_alias(GtkWidget *widget, gpointer *data)
      ^^^^^^^^^
>  GtkWidget *new_alias;
              ^^^^^^^^^
>  new_alias = gtk_button_new_with_label ("New Alias");
   ^^^^^^^^^
>  gtk_signal_connect(GTK_OBJECT(new_alias), "clicked", GTK_SIGNAL_FUNC (new_alias), (gpointer) "New Alias");
                                 ^^^^^^^^^                               ^^^^^^^^^

How is the C compiler supposed to know which definition of new_alias
you want?  It will always use the local-scope definition, and it means
that you are trying to call the address of a button widget as a function.

:-)

michaelkjohnson

"Magazines all too frequently lead to books and should be regarded by the
 prudent as the heavy petting of literature."            -- Fran Lebowitz
 Linux Application Development       http://www.redhat.com/~johnsonm/lad/



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