On Sun, Jun 03, 2007 at 12:28:03PM +0200, Szymon Ząbkiewicz wrote:
> I'm am new to gtk+ and I try to write a simple application, I need to
> read a double from an entry, I've already written a parsing
> *char->double function

Is it really necessary to write yet another floating point
number parser?  You have a whole range of functions from
atof and strtod to sscanf to g_ascii_strtod() available.

> but I can't even read from the entry using
> gtk_editable_get_chars because I get Segmentation Fault. I don't know
> what is the reason for this, so I'll post parts of the code so that
> you could help me in finding the bug:
> 
> ...

The function signature...

> void calculate_cb(GtkWidget *widget, GdkEvent *event, gpointer data)

...does not match the prototype of the callback

>         g_signal_connect(G_OBJECT(main_window->calc_btn), "clicked",
>                 G_CALLBACK(calculate_cb), main_window);

GtkButton::clicked has no GdkEvent* argument
http://developer.gnome.org/doc/API/2.0/gtk/GtkButton.html#GtkButton-clicked
as it is not an event signal.

Looking at the backtrace with gdb and looking at the values
you expected the function to get, you could see calculate_cb()
got main_window as its second argument, not third, which
could be a sufficient hint to check the function signatures
-- just an advice for the future...

Yeti

--
http://gwyddion.net/
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to