From 7ae6fe4a03450beb9c76ba2ba40890b516ec0b6d Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Fri, 16 Oct 2015 10:35:26 -0700 Subject: [PATCH] make sure we have destructors for all objects --- src/RJSList.cpp | 2 +- src/RJSObject.mm | 2 +- src/RJSResults.mm | 2 +- src/RJSUtil.hpp | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/RJSList.cpp b/src/RJSList.cpp index dfb35bb5..66978780 100644 --- a/src/RJSList.cpp +++ b/src/RJSList.cpp @@ -224,6 +224,6 @@ const JSStaticFunction RJSListFuncs[] = { }; JSClassRef RJSListClass() { - static JSClassRef s_listClass = RJSCreateWrapperClass("RealmList", ListGetProperty, ListSetProperty, RJSListFuncs, NULL, ListPropertyNames); + static JSClassRef s_listClass = RJSCreateWrapperClass("RealmList", ListGetProperty, ListSetProperty, RJSListFuncs, ListPropertyNames); return s_listClass; } diff --git a/src/RJSObject.mm b/src/RJSObject.mm index 1d088469..b56c2801 100644 --- a/src/RJSObject.mm +++ b/src/RJSObject.mm @@ -58,7 +58,7 @@ void ObjectPropertyNames(JSContextRef ctx, JSObjectRef object, JSPropertyNameAcc } JSClassRef RJSObjectClass() { - static JSClassRef s_objectClass = RJSCreateWrapperClass("RealmObject", ObjectGetProperty, ObjectSetProperty, NULL, NULL, ObjectPropertyNames); + static JSClassRef s_objectClass = RJSCreateWrapperClass("RealmObject", ObjectGetProperty, ObjectSetProperty, NULL, ObjectPropertyNames); return s_objectClass; } diff --git a/src/RJSResults.mm b/src/RJSResults.mm index 7cdad982..594d48de 100644 --- a/src/RJSResults.mm +++ b/src/RJSResults.mm @@ -124,6 +124,6 @@ JSClassRef RJSResultsClass() { {"sortByProperty", SortByProperty, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontEnum | kJSPropertyAttributeDontDelete}, {NULL, NULL}, }; - static JSClassRef s_objectClass = RJSCreateWrapperClass("Results", ResultsGetProperty, NULL, resultsFuncs, NULL, ResultsPropertyNames); + static JSClassRef s_objectClass = RJSCreateWrapperClass("Results", ResultsGetProperty, NULL, resultsFuncs, ResultsPropertyNames); return s_objectClass; } diff --git a/src/RJSUtil.hpp b/src/RJSUtil.hpp index b53f2034..0ff3beeb 100644 --- a/src/RJSUtil.hpp +++ b/src/RJSUtil.hpp @@ -43,10 +43,11 @@ inline T RJSGetInternal(JSObjectRef jsObject) { } template -JSClassRef RJSCreateWrapperClass(const char * name, JSObjectGetPropertyCallback getter = NULL, JSObjectSetPropertyCallback setter = NULL, const JSStaticFunction *funcs = NULL, JSObjectFinalizeCallback finalize = RJSFinalize, JSObjectGetPropertyNamesCallback propertyNames = NULL) { +JSClassRef RJSCreateWrapperClass(const char * name, JSObjectGetPropertyCallback getter = NULL, JSObjectSetPropertyCallback setter = NULL, const JSStaticFunction *funcs = NULL, + JSObjectGetPropertyNamesCallback propertyNames = NULL) { JSClassDefinition classDefinition = kJSClassDefinitionEmpty; classDefinition.className = name; - classDefinition.finalize = finalize; + classDefinition.finalize = RJSFinalize; classDefinition.getProperty = getter; classDefinition.setProperty = setter; classDefinition.staticFunctions = funcs;