Here's how I understand it...

In the "drag-data-get" callback I call 'g_array_free(tracks, FALSE) ' to 
free the struct but not it's data since gtk_selection_data_set() is 
going to copy it.

In the "drag-data-recieved" callback I call g_free() on the data, but do 
NOT call g_array_free as that is already going to be freed after the 
drag-drop is completed.

Sound right?

- Micah Carrick

  Developer - http://www.micahcarrick.com
  GTK+ Forums - http://www.gtkforums.com



Micah Carrick wrote:
> Let me be more clear...
>
> In my callback for "drag-data-get" I'm trying to pass on a GArray which 
> I use in my callback for "drag-data-recieved". I'm currently doing so 
> with this:
>
> gtk_selection_data_set (data,
>                                         data->target,
>                                         8,
>                                         (gpointer) tracks,
>                                         sizeof (GArray));
>
> Where 'tracks' is a GArray of uint32_t integers.
>
> My question is, do I immediately free the tracks GArray there (but leave 
> the data preserved) and then free the data later in the 
> "drag-data-recieved" callback? Do I free the data at all?
>
> - Micah Carrick
>
>   Developer - http://www.micahcarrick.com
>   GTK+ Forums - http://www.gtkforums.com
>
>
>
> Micah Carrick wrote:
>   
>> In my handler for "drag-data-get" I need to set the selection data to an 
>> array of uint23_t integers. How would I do that using 
>> gtk_selection_data_set ()?
>>
>> I have a g_array() containing the uint32_t data...
>>
>>
>> Secondly, do I need to free the selection data in the handler for 
>> "drag-data-recieved" ?
>>
>>   
>>     
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
>   
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to