From 21cdfc8eae8d338272a25accb104c4704d4471b9 Mon Sep 17 00:00:00 2001 From: Scott Talbert Date: Wed, 29 Dec 2021 16:20:13 -0500 Subject: [PATCH] Avoid creating wxGenericNotificationMessageImpl twice In the case where native wxNotificationMessage is not available and wxGenericNotificationMessage is used as wxNotificationMessage, m_impl was being initialized twice. This happens already in the constructor for wxGenericNotificationMessage. This was causing a leak of a wxGenericNotificationMessageImpl and even more problematic, a leak of a wxFrame, which caused some oddities. So, just remove the initialization from wxNotificationMessage. Closes https://github.com/wxWidgets/wxWidgets/pull/2631 --- src/common/notifmsgcmn.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/notifmsgcmn.cpp b/src/common/notifmsgcmn.cpp index c3507d5930..c3d47ec5e0 100644 --- a/src/common/notifmsgcmn.cpp +++ b/src/common/notifmsgcmn.cpp @@ -91,7 +91,10 @@ bool wxNotificationMessageBase::AddAction(wxWindowID actionid, const wxString &l void wxNotificationMessage::Init() { - m_impl = new wxGenericNotificationMessageImpl(this); + // This is only used when we derive from wxGenericNotificationMessage, + // which already initializes its m_impl correctly, so there is nothing to + // do here (but we still need to have this method for consistency with the + // native implementations). } #endif