Re: Can't correctly set data to an object (button)



Hi,

philippe vivarelli mindspeed com writes:

> Well I  have toggle button to wich I attached a default string ("DEFAULT")
> using the gtk_object_set_user_data function.
> 
> In the callback toggle function I reassign this string regarding the state
> of the button.
> 
> I pick up the new string from a gtk_entry.

you use gtk_entry_get_text() which returns a pointer to the string
owned by the GtkEntry. This pointer becomes invalid as soon as the
text in the entry changes. You'll want to g_strdup() it and use
g_object_set_data_full() with g_free() as destroy notifier.


Salut, Sven



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