Re: libseed-list handling gpointer args/returns



Could you explain why simply setting arg->v_pointer = (gpointer) value would break stuff? And why one should wrap JS values in GValues?

Regarding memory handling, when it's an arg to a function that uses the pointer synchronously, then I guess nothing needs to be done. Just pass the pointer.

In other cases (like callback user_data) one would need to JSValueProtect() it and unprotect it when it's not longer needed (when the callback is destroyed). not sure how to solve that, but I guess this is already done for other arg-types, perhaps depending on gir info about ownership/scope/etc..?

/Jonatan

On 07/29/2010 12:52 AM, Alan Knowles wrote:
The whole pointer/ in out, memory handling needs quite some though.

I've not come up with a idea for a solution that solves all, or even most scenarios without breaking stuff.

It needs some trial and error probably
my guess is that the solution might be only allowing GObjects to be stored in gpointer data - and wrap JS values up in GValues

I've no idea how badly that might affect memory usage though...

Regards
Alan



  --- On 29/Jul/2010, Jonatan Liljedahl wrote:
many functions in GLib take gpointer as args or return values, for
example GLib.async_queue_push(queue, data).

but this doesn't work currently, it gives errors like "ArgumentError
Unable to make argument 2 for function: async_queue_push."

There is a hack in seed_gi_make_argument() that allows strings to be
passed, but this doesn't seem to work either (async_queue_pop() don't
seem to return a pushed string, but undefined)

it should be possible and perhaps even simple to just wrap seed
objects/values in these cases.

what function does the gvalue-to-seed conversion of the return value?

/Jonatan
_______________________________________________
libseed-list mailing list
libseed-list gnome org
http://mail.gnome.org/mailman/listinfo/libseed-list

_______________________________________________
libseed-list mailing list
libseed-list gnome org
http://mail.gnome.org/mailman/listinfo/libseed-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]