Subj : Doing something wrong creating strings for JS function calls To : netscape.public.mozilla.jseng From : Brook Monroe Date : Tue Nov 23 2004 06:02 pm I wrote a general purpose class to wrap SpiderMonkey, with a semi-general-purpose call to access functions written in scripts. One of the things it must to is handle calls in a varargs format, for which some variation on the following snippets is used: union vartype { char ch[2]; char *string; int n; unsigned int u; }; .. .. .. JSString *jStr; .. .. .. var.string = va_arg(ap,char *); jStr = JS_NewString(cx,var.string,strlen(var.string)); params[i] = STRING_TO_JSVAL(jStr); The app crashes when I destruct the class instance, inside js32.dll:js_PurgeDeflatedStringCache(). Clearly, the strings I'm creating aren't done quite correctly...the arguments get where they need to go, but get tidied up too soon. How should I be going about this? jbm! .