aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathRef.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-06-08 12:00:44 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-08 20:15:03 +0000
commitafa11586d782c7cb3e83b8af48023ff227349516 (patch)
tree384b990836f0da6ecb3a00788fdb4e806d2daeb7 /src/core/SkPathRef.cpp
parent1471df99f0c7b5d9df43e7462d68a6635c3c59be (diff)
Make the SkPathRef GenIDChangeListener ref counted
Bug: skia: Change-Id: I2780e3fc76153373b4efca6059ded82f4f749325 Reviewed-on: https://skia-review.googlesource.com/133502 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r--src/core/SkPathRef.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index cc6152a93d..58782df260 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -669,12 +669,11 @@ uint32_t SkPathRef::genID() const {
return fGenerationID;
}
-void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
+void SkPathRef::addGenIDChangeListener(sk_sp<GenIDChangeListener> listener) {
if (nullptr == listener || this == gEmpty) {
- delete listener;
return;
}
- *fGenIDChangeListeners.append() = listener;
+ *fGenIDChangeListeners.append() = listener.release();
}
// we need to be called *before* the genID gets changed or zerod
@@ -684,7 +683,7 @@ void SkPathRef::callGenIDChangeListeners() {
}
// Listeners get at most one shot, so whether these triggered or not, blow them away.
- fGenIDChangeListeners.deleteAll();
+ fGenIDChangeListeners.unrefAll();
}
SkRRect SkPathRef::getRRect() const {