0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 14:01:53 +00:00

Shutdown V8 on GSHUTDOWN

This commit is contained in:
Stefan Siegl 2015-08-02 19:42:03 +02:00
parent 5018192123
commit 4650273c90
3 changed files with 13 additions and 2 deletions

View File

@ -115,6 +115,9 @@ void v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8:
/* Module globals */
ZEND_BEGIN_MODULE_GLOBALS(v8js)
int v8_initialized;
#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036
v8::Platform *v8_platform;
#endif
HashTable *extensions;
/* Ini globals */

View File

@ -200,6 +200,14 @@ static PHP_GSHUTDOWN_FUNCTION(v8js)
v8js_globals->timer_stack.~deque();
v8js_globals->timer_mutex.~mutex();
#endif
if (v8js_globals->v8_initialized) {
v8::V8::Dispose();
v8::V8::ShutdownPlatform();
#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036
delete v8js_globals->v8_platform;
#endif
}
}
/* }}} */

View File

@ -42,8 +42,8 @@ void v8js_v8_init(TSRMLS_D) /* {{{ */
}
#if !defined(_WIN32) && PHP_V8_API_VERSION >= 3029036
v8::Platform* platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
V8JSG(v8_platform) = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(V8JSG(v8_platform));
#endif
/* Set V8 command line flags (must be done before V8::Initialize()!) */