Fixed SIGSEGV 1
- Turns out that g_source_set_callback takes a different function spec, rather
than having a void pointer as an argument it is intended to have a
GIOChannel, condition, and then the void pointer. This actually makes a
fair amount of sense, and sort of makes the API better. I do however wish
that was correctly documented, as it doesn't seem to be mentioned in the
glib documentation.
There are still more SIGSEGVs
closes #50
Note: All this code should be refactored, to provide private
objects to represent each of these items - as opposed to simply a wrapper
around each glib type. Reason being that I'm finding myself having to be far
too creative in finding places to store my data. Also the glib queue item(s)
should be refactored to use only a single source for creation, and keep their
own jsval array for argument lists, store the function being called and context
object locally. Factoring out the code that parses the arguments to the JS
wrapper functions wont actually be possible, but atleast we could make it
so the creation/allocation is handled in a uniform way.
This would make the dispatching also have less stuff to do.
struct queue_item {
int *esid;
JSObject *args;
uintN argc;
JSContext *cx;
};
would instead become
struct queue_item {
int *esid;
JSObject *args;
uintN argc;
JSContext *cx;
JSFunction *callback;
JSObject *this;
};