I encountered a similar problem.
It has to do with "lamba" arguments and is exactly what you encountered, i guess. The problem is, that i need to store the reference.
Simplified my problem is this: I have a "generic" List e.g. ParamList. It has the method void " addParam(void* param, int tId); " registered as " void addParam(const?&in) ".
Calling the Method works fine. The reference works okayish in the addParam method itself. My problem is, that i need to store the reference.
Three ways to do so now, i guess:
1.
ParamList par();
string foo="345";
par.addParam(bleh);
BaseEntity@ ent3=System.instanciate("AbstractNPC","AbstractNPC @AbstractNPC(int,string)",par);
Works fine, as long as i use the Parameter list in the scope in that foo exists.
But when i store the ParamList for caching issues or stuff it kinda breaks.

2. A Wrapper of a reference type like the any addon around the parameter itself
( Like addParam(any(param)); )
3. Registering an interface of the ParameterList and writing a scriptClass implementing that Interface. It would automaticly increase the reference count then if i stored it there.
But im not very comfortable with those solutions. I wonder if there is a better way, or if i can register the addParam method in a different way so the copy of the reference wont be destroyed when the lamba goes out of scope.
Help me, oh grandmaster of angelic scripting, I need your wisdom and swear to obey. ._.
Really, im crawling around the source for some time now and I am growing tired of this problem.
I would simply copy the contents if it wasnt a void* i got there. Makes allocating memory hardly possible, ka?