After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 605710 - Gio::MemoryOutputStream does not work
Gio::MemoryOutputStream does not work
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: giomm
2.22.x
Other All
: Normal critical
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on: 605733
Blocks:
 
 
Reported: 2009-12-30 01:42 UTC by Krzysztof Kosiński
Modified: 2010-02-05 23:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make MemoryOutputStream work. (1.93 KB, patch)
2009-12-30 01:45 UTC, Krzysztof Kosiński
none Details | Review
Use fixed Glib properties (1.07 KB, patch)
2010-01-07 00:32 UTC, Krzysztof Kosiński
committed Details | Review

Description Krzysztof Kosiński 2009-12-30 01:42:01 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.
Comment 1 Krzysztof Kosiński 2009-12-30 01:45:03 UTC
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.
Comment 2 Murray Cumming 2009-12-30 08:30:42 UTC
Can't we correct GMemoryOutputStream? GObjects shouldn't do this in their _new() function.
Comment 3 Krzysztof Kosiński 2009-12-30 15:50:13 UTC
Reported the GLib problem as #605733, it contains a patch.
Comment 4 Krzysztof Kosiński 2009-12-30 15:50:56 UTC
Oops. Here' the URL:
https://bugzilla.gnome.org/show_bug.cgi?id=605733
Comment 5 Jonathon Jongsma 2010-01-06 05:37:48 UTC
adding dependency on the glib bug.
Comment 6 Jonathon Jongsma 2010-01-06 22:55:51 UTC
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.
Comment 7 Krzysztof Kosiński 2010-01-07 00:32:50 UTC
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.
Comment 8 Jonathon Jongsma 2010-01-11 03:52:07 UTC
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.
Comment 9 Murray Cumming 2010-01-28 09:35:52 UTC
I guess this can go in now?
Comment 10 Murray Cumming 2010-02-05 23:20:27 UTC
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.