summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/plugin_object.cc
diff options
context:
space:
mode:
authordmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 19:01:12 +0000
committerdmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 19:01:12 +0000
commitcd90f04a98cb13a76f5c943eefa2cae6ebbf4b21 (patch)
treec28129fa0e06e70ca62307e52f4da99bebb8fad8 /webkit/plugins/ppapi/plugin_object.cc
parent0f64c1daccfc82eab19ad7ed1fb9d5a381ac8875 (diff)
downloadchromium_src-cd90f04a98cb13a76f5c943eefa2cae6ebbf4b21.zip
chromium_src-cd90f04a98cb13a76f5c943eefa2cae6ebbf4b21.tar.gz
chromium_src-cd90f04a98cb13a76f5c943eefa2cae6ebbf4b21.tar.bz2
Fix up some reference counting when WebPluginImpl::scriptableObject is called.
BUG= http://code.google.com/p/chromium-os/issues/detail?id=13605 TEST=none Review URL: http://codereview.chromium.org/6731051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/plugin_object.cc')
-rw-r--r--webkit/plugins/ppapi/plugin_object.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/webkit/plugins/ppapi/plugin_object.cc b/webkit/plugins/ppapi/plugin_object.cc
index d99ef80..d5b9865 100644
--- a/webkit/plugins/ppapi/plugin_object.cc
+++ b/webkit/plugins/ppapi/plugin_object.cc
@@ -290,7 +290,14 @@ PP_Var PluginObject::Create(PluginInstance* instance,
// We can just use a normal ObjectVar to refer to this object from the
// plugin. It will hold a ref to the underlying NPObject which will in turn
// hold our pluginObject.
- return ObjectVar::NPObjectToPPVar(instance, wrapper);
+ PP_Var obj_var(ObjectVar::NPObjectToPPVar(instance, wrapper));
+
+ // Note that the ObjectVar constructor incremented the reference count, and so
+ // did WebBindings::createObject above. Now that the PP_Var has taken
+ // ownership, we need to release to balance out the createObject reference
+ // count bump.
+ WebBindings::releaseObject(wrapper);
+ return obj_var;
}
NPObject* PluginObject::GetNPObject() const {