Fix potential crash if a context with no bindings is released (issue #736).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1271@901 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-11-05 22:33:26 +00:00
parent 737ad31704
commit 358faf993a
2 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,9 @@ class CefV8TrackManager {
v8::Handle<v8::Object> object = context->Global();
v8::Handle<v8::Value> value = object->GetHiddenValue(context_state_key_);
if (value.IsEmpty())
return;
scoped_refptr<CefV8ContextState> state =
static_cast<CefV8ContextState*>(v8::External::Unwrap(value));
state->Detach();

View File

@ -88,6 +88,9 @@ class CefV8TrackManager {
v8::Handle<v8::Object> object = context->Global();
v8::Handle<v8::Value> value = object->GetHiddenValue(context_state_key_);
if (value.IsEmpty())
return;
if (!value.IsEmpty())
return static_cast<CefV8ContextState*>(v8::External::Unwrap(value));