Okay, the actual error seems to stem from the call to setNekoCallback within SWHX. This callback works fine for a period of time (ie. it passes the necessary event), then fails with the error I sent you. I've looked in the swhx source, and it looks as though the objects necessary for the hook are safely reserved, though Edwin doesn't use any functions from the neko api for storing these. Here's the function that's likely to be the cause if it's the hook that's not safely being stored:

static value window_add_message_hook( value w, value id1, value id2 ) { val_check_kind(w,k_window);
   val_check(id1,int32);
   val_check(id2,int32);
   {
       msg_hook_list *n;
       msg_hook_list **ll;
       msg_hook_list *l = malloc(sizeof(struct _msg_hook_list));
       l->next = NULL;
       l->hook = malloc(sizeof(struct _window_msg_hook));
       memset(l->hook,0,sizeof(struct _window_msg_hook));
       l->hook->id1 = (void*) val_int32(id1);
       l->hook->id2 = (void*) val_int32(id2);
       ll = system_window_get_msg_hook_list(val_window(w));
if (n=*ll) { while (n->next) n=n->next;
           n->next = l;
       } else {
*ll = l; } return alloc_abstract(k_window_msg_hook,l->hook); }
}

I'm no experienced C programmer, but all the same, I see nothing wrong with it myself.

Lee






Nicolas Cannasse wrote:
Hi Nicolas,

I've been testing out some functionality from the swhx package,
specifically the new hooking feature, and have been getting a strange
error that I thought only you would know more about.  The error is:
Uncaught exception : Reading outside env.

Any idea's?

That's indeed problematic. It can comes from an invalid compilation
(unlikely) or more probably a method closure that has not been correctly
stored into a root block and then is garbaged before being called (hence
the corrupted environment).

Nicolas



--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to