From fc3c942d113a28089bffd94ff5addc79f3eef673 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 15 Apr 2018 13:46:42 +1000 Subject: Backport: Feature [feature-requests:#1215]. Stop warning about virtual call in destructor. Backport of changeset 6690:2107e0144806. --- win32/PlatWin.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 00b118c82..90433201e 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -513,6 +513,7 @@ class SurfaceGDI : public Surface { void BrushColor(ColourDesired back); void SetFont(Font &font_); + void Clear(); public: SurfaceGDI(); @@ -578,10 +579,10 @@ SurfaceGDI::SurfaceGDI() : } SurfaceGDI::~SurfaceGDI() { - Release(); + Clear(); } -void SurfaceGDI::Release() { +void SurfaceGDI::Clear() { if (penOld) { ::SelectObject(hdc, penOld); ::DeleteObject(pen); @@ -613,6 +614,10 @@ void SurfaceGDI::Release() { } } +void SurfaceGDI::Release() { + Clear(); +} + bool SurfaceGDI::Initialised() { return hdc != 0; } @@ -1066,6 +1071,7 @@ class SurfaceD2D : public Surface { float dpiScaleX; float dpiScaleY; + void Clear(); void SetFont(Font &font_); public: @@ -1147,10 +1153,10 @@ SurfaceD2D::SurfaceD2D() : } SurfaceD2D::~SurfaceD2D() { - Release(); + Clear(); } -void SurfaceD2D::Release() { +void SurfaceD2D::Clear() { if (pBrush) { pBrush->Release(); pBrush = 0; @@ -1167,6 +1173,10 @@ void SurfaceD2D::Release() { } } +void SurfaceD2D::Release() { + Clear(); +} + void SurfaceD2D::SetScale() { HDC hdcMeasure = ::CreateCompatibleDC(NULL); logPixelsY = ::GetDeviceCaps(hdcMeasure, LOGPIXELSY); -- cgit v1.2.3