Bug 1176270 - Handle self-assignment in StyleAnimationValue::operator=. r=dbaron, a=sledru
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 19 Jun 2015 15:56:12 -0700
changeset 275183 3bd6ba33cb82d9c927cf57d1a86e1c43b58cc1f6
parent 275182 1a8c7c8716c436815cc049b475d8f3a9bad9e952
child 275184 71dbe6bca798f4afde28f4f178d5c4302601bf37
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, sledru
bugs1176270
milestone40.0a2
Bug 1176270 - Handle self-assignment in StyleAnimationValue::operator=. r=dbaron, a=sledru
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: