From a750c8a8f4985256b70952d23cd448943fc5570a Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Thu, 24 Mar 2011 14:42:23 -0700 Subject: [PATCH] Another followup to bug 643927 - use the guard-object macro magic to ensure an Auto* class is never temporarily created. r=jwalden --- js/src/jsscript.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 2382f77f281..a602ab8bb41 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -1954,17 +1954,25 @@ class DisablePrincipalsTranscoding { class AutoJSXDRState { public: - AutoJSXDRState(JSXDRState *x) : xdr(x) {} - ~AutoJSXDRState() { + AutoJSXDRState(JSXDRState *x + JS_GUARD_OBJECT_NOTIFIER_PARAM) + : xdr(x) + { + JS_GUARD_OBJECT_NOTIFIER_INIT; + } + ~AutoJSXDRState() + { JS_XDRDestroy(xdr); } - operator JSXDRState*() const { + operator JSXDRState*() const + { return xdr; } private: JSXDRState *const xdr; + JS_DECL_USE_GUARD_OBJECT_NOTIFIER }; JSScript *