Re: How to get stuff out of a GValue?




On Mon, 2007-11-19 at 12:18 +0100, Dan H wrote:
On Mon, 19 Nov 2007 10:56:35 +0000
Emmanuele Bassi <ebassi gmail com> wrote:

Any hints?

just one page further:

http://library.gnome.org/devel/gobject/stable/gobject-Standard-Parameter-and-Value-Types.html

Ah, I'm using the Debian-supplied version 2.12.4, and your page refers to 2.14.3. Thanks. I guess it's just 
missing from my docs.

nope: it's been there for ages. :-)

As it is, I'm having much more fundamental problems. I'm trying to do this to a GtkWidget *child inside 
GtkTable *table:
---------------------

- GValue left_attach;
+ GValue left_attach = { 0, };
+
+ g_value_init (&left_attach);
+
  gtk_container_child_get(GTK_CONTAINER(table), child,
      "left-attach", &left_attach, NULL);

  g_printerr("%s\n", g_strdup_value_contents(&left_attach),
+
+ g_value_unset (&left_attach);

---------------------

And I'm getting this error:

GLib-GObject-CRITICAL **: g_strdup_value_contents: assertion
`G_IS_VALUE (value)' failed

Why?

because you need to initialise the GValue, if it's on the stack. you
also need to unset it to free its contents.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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