diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pdf/SkPDFFormXObject.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pdf/SkPDFFormXObject.cpp b/src/pdf/SkPDFFormXObject.cpp index c1e2192ac7..e148056afe 100644 --- a/src/pdf/SkPDFFormXObject.cpp +++ b/src/pdf/SkPDFFormXObject.cpp @@ -22,6 +22,15 @@ SkPDFFormXObject::SkPDFFormXObject(SkPDFDevice* device) { // resources). device->getResources(&fResources, false); + // Fail fast if in the tree of resources a child references a parent. + // If there is an issue, getResources will end up consuming all memory. + // TODO: A better approach might be for all SkPDFObject to keep track + // of possible cycles. +#ifdef SK_DEBUG + SkTDArray<SkPDFObject*> dummy_resourceList; + getResources(&dummy_resourceList); +#endif + SkRefPtr<SkStream> content = device->content(); content->unref(); // SkRefPtr and content() both took a reference. setData(content.get()); |