Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1547)

Unified Diff: webkit/plugins/ppapi/plugin_object.cc

Issue 6731051: Fix up some reference counting when WebPluginImpl::scriptableObject is called. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/plugin_object.cc
===================================================================
--- webkit/plugins/ppapi/plugin_object.cc (revision 79559)
+++ webkit/plugins/ppapi/plugin_object.cc (working copy)
@@ -290,7 +290,14 @@
// 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 {

Powered by Google App Engine
This is Rietveld 408576698