GNOME Bugzilla – Bug 605710
Gio::MemoryOutputStream does not work
Last modified: 2010-02-05 23:20:27 UTC
The class Gio::MemoryOutputStream does not work at all. Any attempt to write data to it results in a Gio:Error being thrown, saying that the stream is not resizable. The underlying GMemoryOutputStream does not use construction properties and instead directly initializes its private fields. We cannot use the vanilla constructor wrapper - we must call g_memory_output_stream_new, otherwise everything will be initialized to NULL.
Created attachment 150565 [details] [review] Make MemoryOutputStream work. This fix replaces the vanilla wrapper constructor with a workaround that calls g_memory_output_stream_new and uses the pointer-to-gobject base class constructor instead of the one that takes ConstructParams.
Can't we correct GMemoryOutputStream? GObjects shouldn't do this in their _new() function.
Reported the GLib problem as #605733, it contains a patch.
Oops. Here' the URL: https://bugzilla.gnome.org/show_bug.cgi?id=605733
adding dependency on the glib bug.
OK, now that the glib bug is closed, in theory this should just work when glib is upgraded. however, we might want to wrap the new properties now.
Created attachment 150942 [details] [review] Use fixed Glib properties This small patch is required so that the property names match. Aside from wrapping the properties, the constructor should also be fixed to use slots, but it's not trivial - probably better addressed in a separate bug.
Review of attachment 150942 [details] [review]: Ok, this looks fine, but I was actually referring to wrapping the new properties with _WRAP_PROPERTY. I guess we should probably wait until there's a new glib release before we push those changes to git though.
I guess this can go in now?
I have committed that latest patch in comment #7. Thanks. I have also wrapped the properties. So I guess I can close this bug. I'm not very happy with the API of this class in general though. It's far too C-like, particularly the C function pointers. Unfortunately it's apparently been there since glibmm 2.20.