From 52476a443e13b1e2ad5120d4e886847a59dccd53 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 27 Sep 2014 20:51:51 +0000 Subject: [PATCH] Don't leak memory when receiving TaskbarButtonCreated messages. It is possible to receive more than one TaskbarButtonCreated message for the same window, so at the very least don't leak memory if this happens. We really ought to notify the application to allow it to reinitialize the taskbar button in this case though. See #16566. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/frame.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 0114feba9f..bc2db627fb 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -991,7 +991,13 @@ WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPara #if wxUSE_TASKBARBUTTON if ( message == wxMsgTaskbarButtonCreated ) { - m_taskBarButton = wxTaskBarButton::New(this); + if ( !m_taskBarButton ) + m_taskBarButton = wxTaskBarButton::New(this); + //else: If we get this message again, it may mean that our old taskbar + // button can't be used any more and needs to be recreated. We + // need to check whether this is really the case and sent a + // special event to allow the user code to react to this. + processed = true; } #endif