Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: src/doc/SkDocument.cpp

Issue 72833002: Fix DocumentTest/SkDocument memory leaks (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Added comment Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkDocument.h ('k') | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/doc/SkDocument.cpp
===================================================================
--- src/doc/SkDocument.cpp (revision 12300)
+++ src/doc/SkDocument.cpp (working copy)
@@ -10,7 +10,7 @@
SK_DEFINE_INST_COUNT(SkDocument)
-SkDocument::SkDocument(SkWStream* stream, void (*doneProc)(SkWStream*)) {
+SkDocument::SkDocument(SkWStream* stream, void (*doneProc)(SkWStream*, bool)) {
fStream = stream; // we do not own this object.
fDoneProc = doneProc;
fState = kBetweenPages_State;
@@ -68,7 +68,7 @@
bool success = this->onClose(fStream);
if (fDoneProc) {
- fDoneProc(fStream);
+ fDoneProc(fStream, false);
}
// we don't own the stream, but we mark it NULL since we can
// no longer write to it.
@@ -85,5 +85,13 @@
}
void SkDocument::abort() {
+ this->onAbort();
+
fState = kClosed_State;
+ if (fDoneProc) {
+ fDoneProc(fStream, true);
+ }
+ // we don't own the stream, but we mark it NULL since we can
+ // no longer write to it.
+ fStream = NULL;
}
« no previous file with comments | « include/core/SkDocument.h ('k') | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698