Index: ppapi/cpp/array_output.h |
diff --git a/ppapi/cpp/array_output.h b/ppapi/cpp/array_output.h |
index 708150757d67dcc4ff354756759b72dfdebdf6bd..57fa79014061fc95ad9e9ce3a6e49ce81b01f5d3 100644 |
--- a/ppapi/cpp/array_output.h |
+++ b/ppapi/cpp/array_output.h |
@@ -201,6 +201,7 @@ class ArrayOutputAdapterWithStorage : public ArrayOutputAdapter<T> { |
class VarArrayOutputAdapterWithStorage : public ArrayOutputAdapter<PP_Var> { |
public: |
VarArrayOutputAdapterWithStorage(); |
+ virtual ~VarArrayOutputAdapterWithStorage(); |
// Returns the final array of resource objects, converting the PP_Vars |
// written by the browser to pp::Var objects. |
@@ -237,6 +238,13 @@ class ResourceArrayOutputAdapterWithStorage |
set_output(&temp_storage_); |
} |
+ virtual ~ResourceArrayOutputAdapterWithStorage() { |
+ if (!temp_storage_.empty()) { |
+ // An easy way to release the resource references held by this object. |
+ output(); |
+ } |
+ } |
+ |
// Returns the final array of resource objects, converting the PP_Resources |
// written by the browser to resource objects. |
// |