On my port of xffm from gtk3 to gtk4 I already have drag and drop working just fine (apparently). But some times, when I drag from a gridview from one notebook tab to another, I some times a get a series of warnings as below. Apparently it happens when I have more than one droptarget controller in the application (maybe).
Since everything seems to work fine, should I be worried about the warnings? If so, does anyone know off hand what condition triggers the warning? I mean, how could self->drop != drop?
Warning is triggered by a race condition between two or more threads handling drop targets asynchronously. In this circumstance, a critical warning is probably overkill, but there might be other conditions when the warning is indeed critical.
By why use asynchronous drop targets instead of synchronous?
The answer lies in the need for a drop target with GdkContentFormats. Synchronous drop targets are restricted to GTypes.
So, if you create several asynchronous drop targets, the race condition is bound to occur sometime or other.
The fix: use just one asynchronous drop target per application.
At first this solution seems to complicate things a bit, but in the end, not so.
Yes, it is the same thing. The drop still works because the function gtk_drop_target_async_handle_event does not send it further down, and it only refers to the drag-motion callback. The correct drag motion callback will be called in due course.
Since having more than one asynchronous drop target in the application will invariable lead to the warning (in non reproducible way) I would replace line 223 with
if (self->drop == drop) return FALSE;
otherwise document that good practice may involve a single asynchronous drop target per application.