summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-26 13:08:36 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-26 20:46:30 +0000
commit385d32f64613f08bad5cb63f0b8dc4f847f240f4 (patch)
treeed835312989fcf493328605b423ef67faa69f64a /core/fxge
parent06bbdef296b483e6f666156b198319019d3c6373 (diff)
downloadpdfium-385d32f64613f08bad5cb63f0b8dc4f847f240f4.tar.xz
Fix CPDF_PageRenderContext cleanup
Make CFX_RenderDevice, which owns the IFX_RenderDeviceDriver, responsible for restoring driver state as part of its destruction so that its callers don't have to do so out of turn. Then re-order CPDF_PageRenderContext destruction order so that the progressive renderer is destroyed before the device, and the device destroyed before the options because of unowned pointers to objects owned by these. Bug: 726755 Change-Id: I9a6f23da12140b2758b86e6f33f715ad1c679c3f Reviewed-on: https://pdfium-review.googlesource.com/6073 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp
index 4404833758..34c974439a 100644
--- a/core/fxge/ge/cfx_renderdevice.cpp
+++ b/core/fxge/ge/cfx_renderdevice.cpp
@@ -371,6 +371,7 @@ CFX_RenderDevice::CFX_RenderDevice()
m_DeviceClass(0) {}
CFX_RenderDevice::~CFX_RenderDevice() {
+ RestoreState(false);
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
Flush();
#endif
@@ -407,13 +408,16 @@ void CFX_RenderDevice::SaveState() {
}
void CFX_RenderDevice::RestoreState(bool bKeepSaved) {
- m_pDeviceDriver->RestoreState(bKeepSaved);
- UpdateClipBox();
+ if (m_pDeviceDriver) {
+ m_pDeviceDriver->RestoreState(bKeepSaved);
+ UpdateClipBox();
+ }
}
int CFX_RenderDevice::GetDeviceCaps(int caps_id) const {
return m_pDeviceDriver->GetDeviceCaps(caps_id);
}
+
CFX_Matrix CFX_RenderDevice::GetCTM() const {
return m_pDeviceDriver->GetCTM();
}