Bug 1176270 - Handle self-assignment in StyleAnimationValue::operator=. r=dbaron, a=jocheng
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 19 Jun 2015 15:56:12 -0700
changeset 238659 3a4c0af882b52a35e1ef2ef9099557809fc0f7e0
parent 238658 c704eabc07ba2f139cc54f401f9a320c10b153a1
child 238660 6747ebdd53ed422a5c9e1227cc51f7b4706b0a3d
push id709
push userryanvm@gmail.com
push dateFri, 26 Jun 2015 21:28:45 +0000
treeherdermozilla-b2g37_v2_2@3a4c0af882b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, jocheng
bugs1176270
milestone37.0
Bug 1176270 - Handle self-assignment in StyleAnimationValue::operator=. r=dbaron, a=jocheng
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: