diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-24 23:35:51 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-24 23:35:51 +0000 |
commit | 0f3cb003bed09985526391ff19f22ef9e0958401 (patch) | |
tree | 6675ae6a0f0cf893a26282503d02df4cd62bcd01 /chrome | |
parent | f4d34b535564d19fbad5109c8b9535b3ce2df705 (diff) | |
download | chromium_src-0f3cb003bed09985526391ff19f22ef9e0958401.zip chromium_src-0f3cb003bed09985526391ff19f22ef9e0958401.tar.gz chromium_src-0f3cb003bed09985526391ff19f22ef9e0958401.tar.bz2 |
Add a NULL channel check in CreateNPVariantParam as it can be called with
a NULL channel during renderer plugin shutdown.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=4740
R=jam
Bug=4740
Review URL: http://codereview.chromium.org/12609
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5943 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/plugin/npobject_util.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/chrome/plugin/npobject_util.cc b/chrome/plugin/npobject_util.cc index 092e9fc..8936471 100644 --- a/chrome/plugin/npobject_util.cc +++ b/chrome/plugin/npobject_util.cc @@ -171,15 +171,21 @@ void CreateNPVariantParam(const NPVariant& variant, // Don't release, because our original variant is the same as our proxy. release = false; } else { - // NPObjectStub adds its own reference to the NPObject it owns, so if we - // were supposed to release the corresponding variant (release==true), - // we should still do that. - param->type = NPVARIANT_PARAM_OBJECT_ROUTING_ID; - int route_id = channel->GenerateRouteID(); - NPObjectStub* object_stub = new NPObjectStub( - variant.value.objectValue, channel, route_id); - param->npobject_routing_id = route_id; - param->npobject_pointer = variant.value.objectValue; + // The channel could be NULL if there was a channel error. The caller's + // Send call will fail anyways. + if (channel) { + // NPObjectStub adds its own reference to the NPObject it owns, so if + // we were supposed to release the corresponding variant + // (release==true), we should still do that. + param->type = NPVARIANT_PARAM_OBJECT_ROUTING_ID; + int route_id = channel->GenerateRouteID(); + NPObjectStub* object_stub = new NPObjectStub( + variant.value.objectValue, channel, route_id); + param->npobject_routing_id = route_id; + param->npobject_pointer = variant.value.objectValue; + } else { + param->type = NPVARIANT_PARAM_VOID; + } } break; } |