Re: problem using gtk_color_button_get_color
- From: Andreas Madsack <gtk bol bb bawue de>
- To: gtk-app-devel-list gnome org
- Subject: Re: problem using gtk_color_button_get_color
- Date: Mon, 20 Dec 2004 02:11:14 +0100
On Monday 20 December 2004 02:01, Harring Figueiredo wrote:
--- Andreas Madsack <gtk bol bb bawue de> wrote:
Hello,
<...>
You are lucky it does not core dump in the first call :P)
GdkColor *color;
GtkWidget *w;
So far you have not allocated memory to any of the above variables, it
is pointing to lala land. Since you did not get a core dump on the first
call, it is pointing to a memory area dedicated to your process.
gtk_color_button_get_color ((GtkColorButton *)w, color);
and since there is no memory alocated, it will cause what you are
getting.
Here is how you likely want it done.
GdkColor color;
GtkWidget *w;
Make sure 'w' is pointng to a valid, already allocated widget (in this
case a GtkColorButton) (Perhaps you should add a check to see if glade
found you widget.)
i.e.
w=lookup_widget (GTK_WIDGET (button), "colorbutton1");
g_return_if_fail(w != null);
/* down the road, this will save you a lot of grief when debuging if you
happend to change the name of the button! */
gtk_color_button_get_color ((GtkColorButton *)w, &color);
Now, it should work.
yes, it works.
thanks.
--
<>< Andreas Madsack
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]