speculative fix in TransitionView. don't validate after detachFromParent (we may have been deleted)
git-svn-id: http://skia.googlecode.com/svn/trunk@9619 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/TransitionView.cpp b/samplecode/TransitionView.cpp
index 1caff13..e4fa38e 100644
--- a/samplecode/TransitionView.cpp
+++ b/samplecode/TransitionView.cpp
@@ -77,12 +77,18 @@
}
virtual bool onEvent(const SkEvent& evt) {
if (evt.isType(gReplaceTransitionEvt)) {
+ SkView* prev = fPrev;
+ prev->ref();
+
fPrev->detachFromParent();
fPrev = (SkView*)SkEventSink::FindSink(evt.getFast32());
(void)SampleView::SetUsePipe(fPrev, SkOSMenu::kOffState);
//attach the new fPrev and call unref to balance the ref in onDraw
this->attachChildToBack(fPrev)->unref();
this->inval(NULL);
+
+ SkASSERT(1 == prev->getRefCnt());
+ prev->unref();
return true;
}
if (evt.isType("transition-done")) {