Skip to content

Commit

Permalink
Avoid markup text memory leak in wxStaticText
Browse files Browse the repository at this point in the history
Add forgotten destructor.

This should have been even more part of hastily pushed 0f26d71 (Merge
branch 'msw-stattext-markup', 2024-12-12), see wxWidgets#25000.
  • Loading branch information
vadz committed Dec 12, 2024
1 parent d6d61fc commit 7a26088
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/wx/msw/stattext.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase
long style = 0,
const wxString& name = wxASCII_STR(wxStaticTextNameStr));

virtual ~wxStaticText();

// override some methods to resize the window properly
virtual void SetLabel(const wxString& label) override;
virtual bool SetFont( const wxFont &font ) override;
Expand Down
7 changes: 7 additions & 0 deletions src/msw/stattext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ bool wxStaticText::Create(wxWindow *parent,
return true;
}

wxStaticText::~wxStaticText()
{
#if wxUSE_MARKUP
delete m_markupText;
#endif // wxUSE_MARKUP
}

WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
{
WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
Expand Down

0 comments on commit 7a26088

Please sign in to comment.