JavascriptCore: fix cleanup code.
This commit is contained in:
parent
b4534a481a
commit
fcb4833660
1 changed files with 15 additions and 6 deletions
|
|
@ -108,8 +108,13 @@ static JSObjectRef $jswrapper(JSContextRef context, JSObjectRef thisObject, size
|
||||||
static void $jswrapper(JSObjectRef thisObject)
|
static void $jswrapper(JSObjectRef thisObject)
|
||||||
{
|
{
|
||||||
SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
|
SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
|
||||||
if(t && t->swigCMemOwn) free (($jstype)t->swigCObject);
|
if(t) {
|
||||||
if(t) free(t);
|
if (t->swigCMemOwn) {
|
||||||
|
free (($jstype)t->swigCObject);
|
||||||
|
}
|
||||||
|
JSObjectSetPrivate(thisObject, NULL);
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
@ -124,11 +129,15 @@ static void $jswrapper(JSObjectRef thisObject)
|
||||||
static void $jswrapper(JSObjectRef thisObject)
|
static void $jswrapper(JSObjectRef thisObject)
|
||||||
{
|
{
|
||||||
SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
|
SwigPrivData* t = (SwigPrivData*) JSObjectGetPrivate(thisObject);
|
||||||
if(t && t->swigCMemOwn) {
|
if(t) {
|
||||||
$jstype arg1 = ($jstype)t->swigCObject;
|
if (t->swigCMemOwn) {
|
||||||
${destructor_action}
|
$jstype arg1 = ($jstype)t->swigCObject;
|
||||||
|
${destructor_action}
|
||||||
|
}
|
||||||
|
/* remove the private data to make sure that it isn't accessed elsewhere */
|
||||||
|
JSObjectSetPrivate(thisObject, NULL);
|
||||||
|
free(t);
|
||||||
}
|
}
|
||||||
if(t) free(t);
|
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue