From f9aeb2669bcf6fde8eae3975e77fd732d132c277 Mon Sep 17 00:00:00 2001 From: PB Date: Sat, 7 Apr 2018 22:01:18 +0200 Subject: [PATCH] Fix memory leak in taskbarbutton sample wxTaskBarButton::RemoveThumbBarButton() removes the button but does not delete it. In the sample removed buttons must be deleted manually because they are also removed from m_thumbBarButtons which automatically deletes the stored buttons in its destructor. Closes https://github.com/wxWidgets/wxWidgets/pull/778 --- samples/taskbarbutton/taskbarbutton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/taskbarbutton/taskbarbutton.cpp b/samples/taskbarbutton/taskbarbutton.cpp index bbca20d60d..16241b5a93 100644 --- a/samples/taskbarbutton/taskbarbutton.cpp +++ b/samples/taskbarbutton/taskbarbutton.cpp @@ -429,7 +429,7 @@ void MyFrame::OnRemoveThubmBarButton(wxCommandEvent& WXUNUSED(event)) wxThumbBarButton* button = m_thumbBarButtons.back(); m_thumbBarButtons.pop_back(); - MSWGetTaskBarButton()->RemoveThumbBarButton(button); + delete MSWGetTaskBarButton()->RemoveThumbBarButton(button); } void MyFrame::OnThumbnailToolbarBtnClicked(wxCommandEvent& event)