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.
This commit is contained in:
Vadim Zeitlin
2021-10-21 03:10:30 +01:00
parent 1d6e3e3693
commit 373653e4e5
2 changed files with 3 additions and 11 deletions

View File

@@ -90,9 +90,6 @@ private:
// HICON (which can be 0) and destroy the previous image if necessary. // HICON (which can be 0) and destroy the previous image if necessary.
void MSWReplaceImageHandle(WXLPARAM handle); void MSWReplaceImageHandle(WXLPARAM handle);
// Delete the current handle only if we own it.
void DeleteCurrentHandleIfNeeded();
wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap); wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap);
wxDECLARE_EVENT_TABLE(); wxDECLARE_EVENT_TABLE();

View File

@@ -191,20 +191,15 @@ void wxStaticBitmap::Init()
m_ownsCurrentHandle = false; m_ownsCurrentHandle = false;
} }
void wxStaticBitmap::DeleteCurrentHandleIfNeeded() void wxStaticBitmap::Free()
{ {
MSWReplaceImageHandle(0);
if ( m_ownsCurrentHandle ) if ( m_ownsCurrentHandle )
{ {
::DeleteObject(m_currentHandle); ::DeleteObject(m_currentHandle);
m_ownsCurrentHandle = false; m_ownsCurrentHandle = false;
} }
}
void wxStaticBitmap::Free()
{
MSWReplaceImageHandle(0);
DeleteCurrentHandleIfNeeded();
wxDELETE(m_image); wxDELETE(m_image);
} }