A question regarding gtk_clipboard_request_text



I think it would be helpful if the documentation can add some notes about this issue.
What do you guys think?

Thanks
Yong

-----Original Message-----
From: Nickolay V. Shmyrev [mailto:nshmyrev yandex ru] 
Sent: 2005年8月11日 3:39
To: Wang, Yong Y
Cc: gtk-devel-list gnome org
Subject: Re: A question regarding gtk_clipboard_request_text

В Срд, 10/08/2005 в 14:57 +0800, Wang, Yong Y пишет:
> Hi,
> 
> I have a question regarding the function 
> void gtk_clipboard_request_text (GtkClipboard *clipboard, 
> 
> GtkClipboardTextReceivedFunc callback, 
>                                                 gpointer user_data);
> 
> How long is the lifetime of the clipboard data we get via this
> function? 
> Is it as long as the function call to GtkClipboardTextReceivedFunc?
> 
> I wrote two test cases as below:

See http://mail.gnome.org/archives/gtk-devel-list/2005-August/msg00030.html for details.

> Is my understanding correct?
> 
Yes, see 

static void
request_text_received_func (GtkClipboard     *clipboard,
                            GtkSelectionData *selection_data,
                            gpointer          data)

in gtkclipboard.c there is string g_free (result).

the selection data is freed just after the exit of callback. It's better
to strdup it if you are planning to use this string later.

> Thanks 
> Yong
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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