Skip to content

Commit

Permalink
Implement GlobalContext desctructor using JSGlobalContextRelease
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasT committed Jul 20, 2008
1 parent 817974e commit 2801be0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jscore/jscore.pyx
Expand Up @@ -50,6 +50,7 @@ cdef extern from "JavaScriptCore/JavaScript.h":

cdef JSGlobalContextRef JSGlobalContextCreate(JSClassRef globalObjectClass)
cdef JSObjectRef JSContextGetGlobalObject(JSContextRef ctx)
cdef void JSGlobalContextRelease(JSGlobalContextRef ctx)

ctypedef unsigned short JSChar
cdef JSStringRef JSStringCreateWithUTF8CString(const_char_ptr string)
Expand Down Expand Up @@ -191,6 +192,11 @@ cdef class GlobalContext(Context):
def __init__(self):
self.ctx = JSGlobalContextCreate(NULL)

def __dealloc__(self):
cdef JSGlobalContextRef ctx = <JSGlobalContextRef>self.ctx
JSGlobalContextRelease(ctx)
JSGarbageCollect(self.ctx)


cdef class _Value
cdef _value_load(Context ctx, JSValueRef value):
Expand Down

0 comments on commit 2801be0

Please sign in to comment.