gtk_tree_model_get ()



Hi!

in the docs we have
"For example, to get a value from column 0 with type G_TYPE_STRING, you
would write: gtk_tree_model_get (model, iter, 0, &place_string_here, -1),
where place_string_here is a gchar* to be filled with the string. If
appropriate, the returned values have to be freed or unreferenced"

so as I understand that I have to free place_string_here, for example

gchar *s;
gtk_tree_model_get (model, &iter,
                        COLUMN_BLOCKED, &s,
                        -1);
    if (s[0] == 'T')
      s = "Odblokuj";
    else
      s = "Zablokuj";
    g_free (s);

but I get segmentation fault on g_free (s), and valgrind says
Invalid free()
Address 0x8068C2A is not stack'd, malloc'd or (recently) free'd

I want to know if I misunderstood the docs or the docs lies.

regards
hs



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