0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 12:51:52 +00:00

don't manage/free v8::Extension* (v8 does that now)

This commit is contained in:
Stefan Siegl 2019-06-22 01:12:27 +02:00
parent c8be0532f4
commit 93a46f668f
No known key found for this signature in database
GPG Key ID: 73942AF5642F3DDA

View File

@ -67,7 +67,6 @@ struct v8js_jsext {
int deps_count; int deps_count;
zend_string *name; zend_string *name;
zend_string *source; zend_string *source;
v8::Extension *extension;
}; };
/* }}} */ /* }}} */
@ -272,7 +271,6 @@ static void v8js_jsext_free_storage(v8js_jsext *jsext) /* {{{ */
if (jsext->deps) { if (jsext->deps) {
v8js_free_ext_strarr(jsext->deps, jsext->deps_count); v8js_free_ext_strarr(jsext->deps, jsext->deps_count);
} }
delete jsext->extension;
// Free the persisted non-interned strings we allocated. // Free the persisted non-interned strings we allocated.
if (jsext->name) { if (jsext->name) {
@ -1054,7 +1052,7 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval
zend_hash_copy(jsext->deps_ht, Z_ARRVAL_P(deps_arr), v8js_persistent_zval_ctor); zend_hash_copy(jsext->deps_ht, Z_ARRVAL_P(deps_arr), v8js_persistent_zval_ctor);
} }
jsext->extension = new v8::Extension(ZSTR_VAL(jsext->name), ZSTR_VAL(jsext->source), jsext->deps_count, jsext->deps); v8::Extension *extension = new v8::Extension(ZSTR_VAL(jsext->name), ZSTR_VAL(jsext->source), jsext->deps_count, jsext->deps);
if (!zend_hash_add_ptr(v8js_process_globals.extensions, jsext->name, jsext)) { if (!zend_hash_add_ptr(v8js_process_globals.extensions, jsext->name, jsext)) {
v8js_jsext_free_storage(jsext); v8js_jsext_free_storage(jsext);
@ -1068,8 +1066,8 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval
v8js_process_globals.lock.unlock(); v8js_process_globals.lock.unlock();
#endif #endif
jsext->extension->set_auto_enable(auto_enable ? true : false); extension->set_auto_enable(auto_enable ? true : false);
v8::RegisterExtension(std::unique_ptr<v8::Extension>(jsext->extension)); v8::RegisterExtension(std::unique_ptr<v8::Extension>(extension));
return SUCCESS; return SUCCESS;
} }