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 742494 - Can g-i bind hb_blob_create()?
Can g-i bind hb_blob_create()?
Status: RESOLVED NOTABUG
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-01-07 00:20 UTC by Behdad Esfahbod
Modified: 2015-02-07 16:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Behdad Esfahbod 2015-01-07 00:20:40 UTC
Excuse me for filing a bug.  I'm doing so such that we keep the discussion in one place, instead of IRC logs...

I'm trying to bind HarfBuzz and have had great luck so far.  I'm trying to get callbacks working properly though.  If I get this function bound correctly I think I can manage the rest.  Here it is:

hb_blob_t *
hb_blob_create (const char        *data,
                unsigned int       length,
                hb_memory_mode_t   mode,
                void              *user_data,
                hb_destroy_func_t  destroy)

The semantics is that data is input to the function, with length=length.  And when data won't be needed anymore, destroy will be called with user_data passed as callback.  Now, I don't seem to be able to find any way to express this.

I would think I'd need something like this:

 * @data: (array length=length) (element-type uint8_t) (destroy destroy) (scope notified): Pointer to blob data. 
 * @length: Length of @data in bytes. 
 * @mode: Memory mode for @data. 
 * @user_data: (nullable): Data parameter to pass to @destroy. 
 * @destroy: (nullable) (closure user_data): Callback to call when @data is not needed anymore. 

That is, I want data (not a callback) be scoped notified.  And then the binding should take care of passing the right callback to destroy, and feel free to use user_data as it sees fit.

Several things seem wrong with this though.  For one, looks like scope annotation only applies to callbacks, not data parameters.

So, is there any way to express the semantics I want?

Thanks,
behdad
Comment 1 Behdad Esfahbod 2015-01-07 00:37:01 UTC
Jasper suggested that I add new API that takes a GBytes *, and rename that to hb_blob_create().  Works for me.  Thanks Jasper!
Comment 2 André Klapper 2015-02-07 16:48:36 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]