From 1864a49dd2b562bcdf5f848165c050b4a00a6269 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Tue, 13 Feb 2024 12:52:43 +0200 Subject: [PATCH] Fix dialogs sample never exiting with a persistent taskbar icon If the latest user notification shown was shown with "Use persistent taskbar icon" toggled on, the application process would never really exit after closing. So delete m_taskbarIcon in destructor. Closes #24316. --- samples/dialogs/dialogs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index e493326d93..c7805292c6 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -2552,6 +2552,15 @@ public: Bind(wxEVT_BUTTON, &TestNotificationMessageWindow::OnCloseClicked, this, wxID_CLOSE); } + ~TestNotificationMessageWindow() + { +#if defined(__WXMSW__) && wxUSE_TASKBARICON + // If the persistent taskbar icon has been created and is + // not deleted at the end, the application will never exit. + delete m_taskbarIcon; +#endif + } + private: enum {