[Gtk-sharp-list] SelectionData & presistent data

Vladimir Vukicevic vladimir@pobox.com
Wed, 30 Oct 2002 22:56:20 -0800 (PST)


Hmm.  Not sure what the right way to solve this is.  When dealing with
a Gtk.SelectionData struct, such as the one that's passed to a
ClipboardGetFunction, I need to call set_data or set_text on the
struct with a piece of data whose pointer gets stored in the struct.

However, when I call sd.Text = "abc" (which calls
gtk_selection_data_set_text ("abc", 3)), the string "abc" I believe
exists only for the duration of that function call.  The pointer that
gets stored in the struct thus becomes bogus, and the real data isn't
ever really available.

What's the right way to do this?  Do we need something like a C#
wrapper around g_memdup and g_free for creating little persistent
chunks of data like this?

       - Vlad