Reputation: 537
I tried to convert GdkRGBA
to a gchar *
with the function gdk_rgba_to_string()
. For instance:
GdkRGBA *color_01;
gchar *color_string = gdk_rgba_to_string(color_01);
In my code, this one gives segmentation fault, why is that?
Upvotes: 2
Views: 149
Reputation: 727047
This code crashes because you need to allocate memory to a pointer, or to allocate the structure in automatic or static memory, for example
GdkRGBA color = {0};
gchar *color_as_string = gdk_rgba_to_string(&color);
Upvotes: 3