Bug 856080 - Fix a ComputedTimingFunction leak in Layers. r=jrmuizel, a=tef+
authorChristophe Mouraud <christophe.mouraud@innes.fr>
Mon, 08 Apr 2013 14:31:10 -0400
changeset 119214 eec81d0b7e2664f739017119124bdbeb2e24bb1f
parent 119213 740b14c16f81f466acd0e07b4359d979ea510804
child 119215 80006d35bd277576c2995d21b19631dc5d46a43e
push id734
push userryanvm@gmail.com
push dateTue, 30 Apr 2013 12:38:08 +0000
reviewersjrmuizel, tef
bugs856080
milestone18.0
Bug 856080 - Fix a ComputedTimingFunction leak in Layers. r=jrmuizel, a=tef+
gfx/layers/Layers.cpp
gfx/layers/Layers.h
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -471,17 +471,17 @@ CreateCSSValueList(const InfallibleTArra
 
 void
 Layer::SetAnimations(const AnimationArray& aAnimations)
 {
   mAnimations = aAnimations;
   mAnimationData.Clear();
   for (uint32_t i = 0; i < mAnimations.Length(); i++) {
     AnimData* data = mAnimationData.AppendElement();
-    InfallibleTArray<css::ComputedTimingFunction*>& functions = data->mFunctions;
+    InfallibleTArray<nsAutoPtr<css::ComputedTimingFunction> >& functions = data->mFunctions;
     nsTArray<AnimationSegment> segments = mAnimations.ElementAt(i).segments();
     for (uint32_t j = 0; j < segments.Length(); j++) {
       TimingFunction tf = segments.ElementAt(j).sampleFn();
       css::ComputedTimingFunction* ctf = new css::ComputedTimingFunction();
       switch (tf.type()) {
         case TimingFunction::TCubicBezierFunction: {
           CubicBezierFunction cbf = tf.get_CubicBezierFunction();
           ctf->Init(nsTimingFunction(cbf.x1(), cbf.y1(), cbf.x2(), cbf.y2()));
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -529,17 +529,17 @@ private:
 };
 
 class ThebesLayer;
 typedef InfallibleTArray<Animation> AnimationArray;
 
 struct AnimData {
   InfallibleTArray<nsStyleAnimation::Value> mStartValues;
   InfallibleTArray<nsStyleAnimation::Value> mEndValues;
-  InfallibleTArray<mozilla::css::ComputedTimingFunction*> mFunctions;
+  InfallibleTArray<nsAutoPtr<mozilla::css::ComputedTimingFunction> > mFunctions;
 };
 
 /**
  * A Layer represents anything that can be rendered onto a destination
  * surface.
  */
 class THEBES_API Layer {
   NS_INLINE_DECL_REFCOUNTING(Layer)