mirror of https://github.com/axmolengine/axmol.git
Fixing restart of context to not leak memory
This commit is contained in:
parent
e7ac758b9f
commit
eafd6ebf08
|
@ -372,6 +372,12 @@ void ScriptingCore::removeAllRoots(JSContext *cx) {
|
|||
js_proxy_t *current, *tmp;
|
||||
HASH_ITER(hh, _js_native_global_ht, current, tmp) {
|
||||
JS_RemoveObjectRoot(cx, ¤t->obj);
|
||||
HASH_DEL(_js_native_global_ht, current);
|
||||
free(current);
|
||||
}
|
||||
HASH_ITER(hh, _native_js_global_ht, current, tmp) {
|
||||
HASH_DEL(_native_js_global_ht, current);
|
||||
free(current);
|
||||
}
|
||||
HASH_CLEAR(hh, _js_native_global_ht);
|
||||
HASH_CLEAR(hh, _native_js_global_ht);
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
template <class T>
|
||||
inline js_type_class_t *js_get_type_from_native(T* native_obj) {
|
||||
js_type_class_t *typeProxy;
|
||||
const char *n = typeid(*native_obj).name();
|
||||
long typeId = getHashCodeByString(n);
|
||||
long typeId = getHashCodeByString(typeid(*native_obj).name());
|
||||
HASH_FIND_INT(_js_global_type_ht, &typeId, typeProxy);
|
||||
if (!typeProxy) {
|
||||
TypeInfo *typeInfo = dynamic_cast<TypeInfo *>(native_obj);
|
||||
|
|
Loading…
Reference in New Issue