Bug 1176270: Handle self-assignment in StyleAnimationValue::operator=. r=dbaron
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 19 Jun 2015 15:56:12 -0700
changeset 267945 2afd5728f13aebe9c2daa85dd831b4e4ac2ac121
parent 267944 a79cb8e688cd19e6bc8971f87ccad559a154b112
child 267946 f844ada1acf802a89de006ba91391371a4fc3efc
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1176270
milestone41.0a1
Bug 1176270: Handle self-assignment in StyleAnimationValue::operator=. r=dbaron a=KWierso to land while checkins are metered
layout/style/StyleAnimationValue.cpp
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -3559,16 +3559,20 @@ StyleAnimationValue::StyleAnimationValue
 {
   mUnit = eUnit_Color;
   mValue.mColor = aColor;
 }
 
 StyleAnimationValue&
 StyleAnimationValue::operator=(const StyleAnimationValue& aOther)
 {
+  if (this == &aOther) {
+    return *this;
+  }
+
   FreeValue();
 
   mUnit = aOther.mUnit;
   switch (mUnit) {
     case eUnit_Null:
     case eUnit_Normal:
     case eUnit_Auto:
     case eUnit_None: