Am I doing something wrong? And, is there possibility to prevent segfault when this wrong method is used? I would like to let users to use some in-game scripting, but I really don't want to let them crash entire thing.

Hello again. I'm sorry for my late response, there were some trouble with my account and I was not able to login.

Andreas, I modified your code a little so now its manifest same problem. Main difference is that my addListener method is in c++, not AS. Here is code and here is zipped eclipse project as well.
When I launch this code, both addListener calls...

It turns out the problem wasn't 64bit specific after all.<br /><br />With the code you provided I found the problem. It was related to passing a handle stored in a temporary variable to a function that expected a non-handle inout reference. In this specific case the compiler didn't properly dereference the pointer on the stack so the function ended up receiving a pointer to the handle, rather than the object itself.<br /><br />I've fixed this problem in revision 1522.<br /><br />Thanks for the help in reproducing the problem.