From 373653e4e5486f7bf7c98ef79709cfdd5a35b360 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Oct 2021 03:10:30 +0100 Subject: [PATCH] Remove unnecessary wxStaticBitmap::DeleteCurrentHandleIfNeeded() This function was used exactly once and it's simpler and more clear to just inline it into Free() where it was called. No real changes, this is just a small simplification. --- include/wx/msw/statbmp.h | 3 --- src/msw/statbmp.cpp | 11 +++-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/include/wx/msw/statbmp.h b/include/wx/msw/statbmp.h index 990483d06a..1e88548995 100644 --- a/include/wx/msw/statbmp.h +++ b/include/wx/msw/statbmp.h @@ -90,9 +90,6 @@ private: // HICON (which can be 0) and destroy the previous image if necessary. void MSWReplaceImageHandle(WXLPARAM handle); - // Delete the current handle only if we own it. - void DeleteCurrentHandleIfNeeded(); - wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); wxDECLARE_EVENT_TABLE(); diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index 29cacc6b5c..4c6d7cc2a1 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -191,20 +191,15 @@ void wxStaticBitmap::Init() m_ownsCurrentHandle = false; } -void wxStaticBitmap::DeleteCurrentHandleIfNeeded() +void wxStaticBitmap::Free() { + MSWReplaceImageHandle(0); + if ( m_ownsCurrentHandle ) { ::DeleteObject(m_currentHandle); m_ownsCurrentHandle = false; } -} - -void wxStaticBitmap::Free() -{ - MSWReplaceImageHandle(0); - - DeleteCurrentHandleIfNeeded(); wxDELETE(m_image); }