diff options
| author | Wez Furlong <wez@php.net> | 2003-12-18 11:23:21 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2003-12-18 11:23:21 +0000 |
| commit | 09907c6b93c07894f0bda63f489f61fac57ef768 (patch) | |
| tree | 4efcd732c99eea209cb6e3642909d6d7b4b5469a /ext/com_dotnet/com_dotnet.c | |
| parent | 48a2b2a3d30f6a89b2fa5dfc6cfdaeef0bdf621c (diff) | |
| download | php-git-09907c6b93c07894f0bda63f489f61fac57ef768.tar.gz | |
Fix use of the CorRuntimeHost; once it has been stopped for a process, it cannot be restarted, so we keep it alive for the duration of the process, and instead close down the application domain in
request shutdown.
Diffstat (limited to 'ext/com_dotnet/com_dotnet.c')
| -rw-r--r-- | ext/com_dotnet/com_dotnet.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index a30237dd69..9b39b678e4 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -49,7 +49,7 @@ static int dotnet_init(TSRMLS_D) IUnknown *unk = NULL; OLECHAR *olename; - stuff = emalloc(sizeof(*stuff)); + stuff = malloc(sizeof(*stuff)); memset(stuff, 0, sizeof(*stuff)); if (SUCCEEDED(CoCreateInstance(&CLSID_CorRuntimeHost, NULL, CLSCTX_ALL, @@ -84,7 +84,7 @@ static int dotnet_init(TSRMLS_D) ICorRuntimeHost_Stop(stuff->dotnet_host); ICorRuntimeHost_Release(stuff->dotnet_host); } - efree(stuff); + free(stuff); return FAILURE; } @@ -178,18 +178,30 @@ PHP_FUNCTION(com_dotnet_create_instance) } /* }}} */ +void php_com_dotnet_mshutdown(TSRMLS_D) +{ + struct dotnet_runtime_stuff *stuff = COMG(dotnet_runtime_stuff); + + if (stuff->dotnet_domain) { + IDispatch_Release(stuff->dotnet_domain); + } + if (stuff->dotnet_host) { + ICorRuntimeHost_Stop(stuff->dotnet_host); + ICorRuntimeHost_Release(stuff->dotnet_host); + stuff->dotnet_host = NULL; + } + free(stuff); + COMG(dotnet_runtime_stuff) = NULL; +} void php_com_dotnet_rshutdown(TSRMLS_D) { struct dotnet_runtime_stuff *stuff = COMG(dotnet_runtime_stuff); - IDispatch_Release(stuff->dotnet_domain); - ICorRuntimeHost_Stop(stuff->dotnet_host); - ICorRuntimeHost_Release(stuff->dotnet_host); - - efree(stuff); - - COMG(dotnet_runtime_stuff) = NULL; + if (stuff->dotnet_domain) { + IDispatch_Release(stuff->dotnet_domain); + stuff->dotnet_domain = NULL; + } } #endif /* HAVE_MSCOREE_H */ |
