SelectionData.get_targets crashes with "Unable to resize vector"
I have been trying to implement drag and drop support, so have needed to get the targets from Gtk.SelectionData. When ever I call get_targets, the program crashes with an error message like
(gjs:4288): Gjs-ERROR **: 09:05:06.317: Unable to resize vector
I have produced a small example that demonstrates this issue:
const Gtk = imports.gi.Gtk;
const app = new Gtk.Application();
app.connect('startup', () => {
const window = new Gtk.ApplicationWindow({ application: app, default_height: 325, default_width: 720});
const entry = new Gtk.Entry();
entry.connect('drag-data-received', (entry, context, x, y, data) => {
data.get_targets();
});
window.add(entry);
window.show_all();
});
app.run([]);
Dragging and dropping a file onto the chat entry gives the error message. I am running Gjs 1.52.1