let fbuilder = gdk::ContentFormatsBuilder::new();
let formats = fbuilder.to_formats().unwrap();
let handler = gtk::DropTargetAsync::new(Some(&formats), gdk::DragAction::COPY);
handler.connect_accept({
|_target, drop| {
if let Some(f) = drop.get_formats() {
return f.contain_mime_type("text/x-moz-url");
}
false
}
});
handler.connect_drop(move |_target, drop, _x, _y| {
if let Some(f) = drop.get_formats() {
if f.contain_mime_type("text/x-moz-url") {
// ... read async data ...
drop.finish(gdk::DragAction::COPY);
return true;
}
}
false
});
The code works and the data in the drop is read - also when dropping several times. However, beginning with the second time, the following critical appears each time before the ‘accept’ callback is executed:
Any help, what I need to do differenly? Just handling the ‘enter’ signal didn’t do the trick. It seems the GdkDrop is reused but doesn’t get reinitialized.
I’ve created a minimal Python example to check potential problems with the Rust version, but I get the same problem. When dropping the second time (and every time afterwards), the critical message is logged:
I don’t know how that API is supposed to be used exactly, but as the critical doesn’t even happen from any of the functions you call, I would assume that this is actually a bug in GTK. And even if not, it would at least be missing documentation. Maybe report an issue here?