From a0dcd29f536b195681684b3105842970d82383a5 Mon Sep 17 00:00:00 2001 From: KDr2 Date: Thu, 14 Feb 2019 08:49:30 +0000 Subject: [PATCH] Fix bug of the destructor of SkSVGDevice When SkSVGDevice owns `fWriter`, we must ensure that `fRootElement` is destructed before `fWriter`. Otherwise, while `fRootElement` is destrcuting, it tries to write data into `fWriter` who is alreay deleted. This bug is introduced by https://skia-review.googlesource.com/c/skia/+/192040. Change-Id: Idbb998a3c25f6e0d731e5070fd9f9bdde3afcd1a Reviewed-on: https://skia-review.googlesource.com/c/192301 Reviewed-by: Florin Malita Commit-Queue: Florin Malita --- src/svg/SkSVGDevice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp index 579cc79e76b6a..0635d30c7c81b 100644 --- a/src/svg/SkSVGDevice.cpp +++ b/src/svg/SkSVGDevice.cpp @@ -664,6 +664,7 @@ SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer, bool ownsWrit SkSVGDevice::~SkSVGDevice() { if (fOwnsWriter && fWriter) { + fRootElement.reset(nullptr); delete fWriter; } }