From 699d75f881ad79e98f9400eeb4a7f86a749b1521 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 15 Apr 2018 13:46:42 +1000 Subject: Feature [feature-requests:#1215]. Stop warning about virtual call in destructor. --- qt/ScintillaEditBase/PlatQt.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'qt/ScintillaEditBase/PlatQt.cpp') diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index 87496a191..e32fec67d 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -165,7 +165,23 @@ SurfaceImpl::SurfaceImpl() SurfaceImpl::~SurfaceImpl() { - Release(); + Clear(); +} + +void SurfaceImpl::Clear() +{ + if (painterOwned && painter) { + delete painter; + } + + if (deviceOwned && device) { + delete device; + } + + device = 0; + painter = 0; + deviceOwned = false; + painterOwned = false; } void SurfaceImpl::Init(WindowID wid) @@ -197,18 +213,7 @@ void SurfaceImpl::InitPixMap(int width, void SurfaceImpl::Release() { - if (painterOwned && painter) { - delete painter; - } - - if (deviceOwned && device) { - delete device; - } - - device = 0; - painter = 0; - deviceOwned = false; - painterOwned = false; + Clear(); } bool SurfaceImpl::Initialised() -- cgit v1.2.3