On Sat, Jun 25, 2011 at 2:07 AM, Stephan Beal <[email protected]> wrote:

> Unlocker unl;
> T rv( theFunction(...) );
> unl.~Unlocker(); // <----- this part
> return rv;
>

Nevermind, that's asserting in v8 and is probably just evil, anyway. What
i've done as a workaround:

    template <bool> struct V8Unlocker;

    template <>
    struct V8Unlocker<true>
    {
        private:
            v8::Unlocker * unlocker;
        public:
            V8Unlocker() :
                unlocker(new v8::Unlocker)
            {}
            ~V8Unlocker()
            {
                this->Dispose();
            }
            void Dispose()
            {
                delete unlocker;
                unlocker = NULL;
            }
    };
    template <>
    struct V8Unlocker<false>
    {
        inline void Dispose() const
        {}
    };


and use Dispose() for the cases where i need to de-scope the unlocker before
it actually goes out of scope.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to