bug 512260 - part 6 - lock images in nsStyleList::SetListStyleImage.r=dbaron,a=blocker
authorBobby Holley <bobbyholley@gmail.com>
Mon, 16 Aug 2010 12:23:09 -0400
changeset 50820 9594f23591a12dbecc1908f1ca9e1b8a0ac6034b
parent 50819 832a644e8dcac50c7db4c44ac86ba8201fac1a90
child 50822 9ef027bf21208bd0a4df2e8a4004669ea8928abd
push idunknown
push userunknown
push dateunknown
reviewersdbaron, blocker
bugs512260
milestone2.0b5pre
bug 512260 - part 6 - lock images in nsStyleList::SetListStyleImage.r=dbaron,a=blocker
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -641,19 +641,19 @@ nsStyleList::nsStyleList()
 nsStyleList::~nsStyleList() 
 {
   MOZ_COUNT_DTOR(nsStyleList);
 }
 
 nsStyleList::nsStyleList(const nsStyleList& aSource)
   : mListStyleType(aSource.mListStyleType),
     mListStylePosition(aSource.mListStylePosition),
-    mListStyleImage(aSource.mListStyleImage),
     mImageRegion(aSource.mImageRegion)
 {
+  SetListStyleImage(aSource.GetListStyleImage());
   MOZ_COUNT_CTOR(nsStyleList);
 }
 
 nsChangeHint nsStyleList::CalcDifference(const nsStyleList& aOther) const
 {
   if (mListStylePosition != aOther.mListStylePosition)
     return NS_STYLE_HINT_FRAMECHANGE;
   if (EqualImages(mListStyleImage, aOther.mListStyleImage) &&
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1045,23 +1045,28 @@ struct nsStyleList {
 #ifdef DEBUG
   static nsChangeHint MaxDifference();
 #endif
   static PRBool ForceCompare() { return PR_FALSE; }
 
   imgIRequest* GetListStyleImage() const { return mListStyleImage; }
   void SetListStyleImage(imgIRequest* aReq)
   {
+    if (mListStyleImage)
+      mListStyleImage->UnlockImage();
     mListStyleImage = aReq;
+    if (mListStyleImage)
+      mListStyleImage->LockImage();
   }
 
   PRUint8   mListStyleType;             // [inherited] See nsStyleConsts.h
   PRUint8   mListStylePosition;         // [inherited]
 private:
   nsCOMPtr<imgIRequest> mListStyleImage; // [inherited]
+  nsStyleList& operator=(const nsStyleList& aOther); // Not to be implemented
 public:
   nsRect        mImageRegion;           // [inherited] the rect to use within an image
 };
 
 struct nsStylePosition {
   nsStylePosition(void);
   nsStylePosition(const nsStylePosition& aOther);
   ~nsStylePosition(void);