gobject-introspection should annotate pointer plus GDestroyNotify, e.g. in g_memory_input_stream_new_from_data()
@ptomato
Submitted by Philip Chimento Link to original bug (#747431)
Description
Consider the following GJS program:
const Gio = imports.gi.Gio;
let stream = Gio.MemoryInputStream.new_from_data('', -1, null);
This segfaults. I believe it's because GJS frees the string data before freeing the GMemoryInputStream at the end of the program. PyGObject seems to copy the data and doesn't segfault.
However, I don't think it's possible to properly use this function in introspected bindings; really, no-one should have to pass in a GDestroyNotify to introspected API. (This was kind of a side effect of https://bugzilla.gnome.org/show_bug.cgi?id=589887 which was eventually closed with no changes.) And there's really no sensible value to pass besides NULL.
Now that we have g_memory_input_stream_new_from_bytes() I think ..._new_from_data() should be annotated with (skip).
Edited by Philip Chimento