Fix a memory leak in the new Canvas/Device workflow.
The previous change made it difficult to inherit from SkCanvas without leaking memory. By making SkDeviceFactory not reference counted, the right thing happens more naturally, just NewCanvas : public SkCanvas(new NewDeviceFactory()) {...}
Review URL: http://codereview.appspot.com/2530042
git-svn-id: http://skia.googlecode.com/svn/trunk@605 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 7cda41e..baf5d84 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -409,7 +409,6 @@
fDeviceFactory(factory) {
inc_canvas();
- SkSafeRef(factory);
if (!factory)
fDeviceFactory = SkNEW(SkRasterDeviceFactory);
@@ -439,8 +438,8 @@
this->internalRestore(); // restore the last, since we're going away
SkSafeUnref(fBounder);
- SkSafeUnref(fDeviceFactory);
-
+ SkDELETE(fDeviceFactory);
+
dec_canvas();
}