Index: src/core/SkPixelRef.cpp |
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp |
index f56298165cd67648276272f6667d9753c38b604e..a2638c9431777d7301aed5acc25ed037c70c21cb 100644 |
--- a/src/core/SkPixelRef.cpp |
+++ b/src/core/SkPixelRef.cpp |
@@ -5,6 +5,7 @@ |
* found in the LICENSE file. |
*/ |
+#include "SkBitmapCache.h" |
#include "SkPixelRef.h" |
#include "SkThread.h" |
@@ -222,6 +223,7 @@ void SkPixelRef::addGenIDChangeListener(GenIDChangeListener* listener) { |
*fGenIDChangeListeners.append() = listener; |
} |
+// we need to be called *before* the genID gets changed or zerod |
void SkPixelRef::callGenIDChangeListeners() { |
// We don't invalidate ourselves if we think another SkPixelRef is sharing our genID. |
if (fUniqueGenerationID) { |
@@ -231,6 +233,15 @@ void SkPixelRef::callGenIDChangeListeners() { |
} |
// Listeners get at most one shot, so whether these triggered or not, blow them away. |
fGenIDChangeListeners.deleteAll(); |
+ |
+ // if fGenerationID is 0, then perhaps we never had one, and we are in the destructor |
+ if (fGenerationID) { |
+ // If the ResourceCache ever generalizes/standardizes on accessing the gen-id field, |
+ // then it would be more efficient to roll these together, and only grab the mutex |
+ // and fixing the resources once... |
+ SkBitmapCache::NotifyGenIDStale(fGenerationID); |
+ SkMipMapCache::NotifyGenIDStale(fGenerationID); |
+ } |
} |
void SkPixelRef::notifyPixelsChanged() { |