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
This commit is contained in:
Scott Talbert
2021-12-29 16:20:13 -05:00
committed by Vadim Zeitlin
parent 584282800e
commit 21cdfc8eae

View File

@@ -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