aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/pdf/SkPDFDevice.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index e253a5fc35..00411a195a 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -495,6 +495,22 @@ struct ContentEntry {
GraphicStateEntry fState;
SkDynamicMemoryWStream fContent;
SkTScopedPtr<ContentEntry> fNext;
+
+ // If the stack is too deep we could get Stack Overflow.
+ // So we manually destruct the object.
+ ~ContentEntry() {
+ ContentEntry* val = fNext.release();
+ if (NULL == val) {
+ return;
+ }
+
+ while (val != NULL) {
+ ContentEntry* valNext = val->fNext.release();
+ // When the destructor is called, fNext is NULL and exits.
+ delete val;
+ val = valNext;
+ }
+ }
};
// A helper class to automatically finish a ContentEntry at the end of a