Don't leak wxMSWHeaderCtrlCustomDraw in dark mode
The pointer may have been already allocated when the code initializing it in Create() when using dark mode is executed, so unconditionally reassigning to it leaked memory.
This commit is contained in:
parent
e97d27165a
commit
9d21630069
1 changed files with 5 additions and 1 deletions
|
|
@ -221,7 +221,11 @@ bool wxMSWHeaderCtrl::Create(wxWindow *parent,
|
|||
|
||||
if ( wxMSWDarkMode::IsActive() )
|
||||
{
|
||||
m_customDraw = new wxMSWHeaderCtrlCustomDraw();
|
||||
// Note that it may have been already allocated by MSWCreateControl()
|
||||
// which calls SetFont() from InheritAttributes(), so don't recreate it
|
||||
// in this case.
|
||||
if ( !m_customDraw )
|
||||
m_customDraw = new wxMSWHeaderCtrlCustomDraw();
|
||||
m_customDraw->UseHeaderThemeColors(GetHwnd());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue