1
0
Fork 0

After freeing the locker, null its struct member so we remain to know its gone.

This commit is contained in:
Willi Goesgens 2015-01-08 16:20:30 +01:00
parent ff0a8cd1c8
commit 9e26914696
1 changed files with 9 additions and 0 deletions

View File

@ -505,6 +505,7 @@ void ApplicationV8::exitContext (V8Context* context) {
_busyContexts[name].erase(context); _busyContexts[name].erase(context);
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
TRI_ASSERT(! v8::Locker::IsLocked(isolate)); TRI_ASSERT(! v8::Locker::IsLocked(isolate));
guard.broadcast(); guard.broadcast();
@ -546,6 +547,7 @@ void ApplicationV8::exitContext (V8Context* context) {
} }
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
_freeContexts[name].push_back(context); _freeContexts[name].push_back(context);
} }
@ -658,6 +660,7 @@ void ApplicationV8::collectGarbage () {
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
// update garbage collection statistics // update garbage collection statistics
context->_hasDeadObjects = false; context->_hasDeadObjects = false;
@ -765,6 +768,7 @@ void ApplicationV8::upgradeDatabase (bool skip,
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
if (perform) { if (perform) {
// issue #391: when invoked with --upgrade, the server will not always shut down // issue #391: when invoked with --upgrade, the server will not always shut down
@ -854,6 +858,7 @@ void ApplicationV8::versionCheck () {
} }
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
// regular shutdown... wait for all threads to finish // regular shutdown... wait for all threads to finish
@ -960,6 +965,7 @@ bool ApplicationV8::prepareNamedContexts (const string& name,
} }
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
} }
return result; return result;
@ -1366,6 +1372,7 @@ bool ApplicationV8::prepareV8Instance (const string& name, size_t i, bool useAct
} }
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
// initialise garbage collection for context // initialise garbage collection for context
context->_numExecutions = 0; context->_numExecutions = 0;
@ -1410,6 +1417,7 @@ void ApplicationV8::prepareV8Server (const string& name, const size_t i, const s
} }
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
// initialise garbage collection for context // initialise garbage collection for context
LOG_TRACE("initialised V8 server #%d", (int) i); LOG_TRACE("initialised V8 server #%d", (int) i);
@ -1453,6 +1461,7 @@ void ApplicationV8::shutdownV8Instance (const string& name, size_t i) {
isolate->Exit(); isolate->Exit();
delete context->_locker; delete context->_locker;
context->_locker = nullptr;
isolate->Dispose(); isolate->Dispose();