From 5e042a1bcd236737b99781e2d5f3a601df4baedc Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 30 May 2017 14:13:44 -0700 Subject: Fix OnDestroy method for scroll bars Bug: 727048 Change-Id: Ib2ce898eeb814f17fca852bcf670678f734d905f Reviewed-on: https://pdfium-review.googlesource.com/6083 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 11 +++++++++++ fpdfsdk/pdfwindow/PWL_ScrollBar.h | 1 + 2 files changed, 12 insertions(+) diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index 1c3efb1faa..36ee5c762f 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -575,6 +575,17 @@ void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_ARROW; } +void CPWL_ScrollBar::OnDestroy() { + // Until cleanup takes place in the virtual destructor for CPWL_Wnd + // subclasses, implement the virtual OnDestroy method that does the + // cleanup first, then invokes the superclass OnDestroy ... gee, + // like a dtor would. + m_pMinButton.Release(); + m_pMaxButton.Release(); + m_pPosButton.Release(); + CPWL_Wnd::OnDestroy(); +} + void CPWL_ScrollBar::RePosChildWnd() { CFX_FloatRect rcClient = GetClientRect(); CFX_FloatRect rcMinButton, rcMaxButton; diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/pdfwindow/PWL_ScrollBar.h index 41df6550e0..165d0e022c 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.h @@ -124,6 +124,7 @@ class CPWL_ScrollBar : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; void OnCreate(PWL_CREATEPARAM& cp) override; + void OnDestroy() override; void RePosChildWnd() override; void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, -- cgit v1.2.3