Skip to content

Commit

Permalink
Fix bug of the destructor of SkSVGDevice
Browse files Browse the repository at this point in the history
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 <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
  • Loading branch information
KDr2 authored and Skia Commit-Bot committed Feb 14, 2019
1 parent 729bb19 commit a0dcd29
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/svg/SkSVGDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer, bool ownsWrit

SkSVGDevice::~SkSVGDevice() {
if (fOwnsWriter && fWriter) {
fRootElement.reset(nullptr);
delete fWriter;
}
}
Expand Down

0 comments on commit a0dcd29

Please sign in to comment.