git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53563
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
protected:
wxTaskBarIconArea *m_iconWnd;
protected:
wxTaskBarIconArea *m_iconWnd;
+private:
+ void OnDestroy(wxWindowDestroyEvent&);
+
DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
};
DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
};
return m_iconWnd != NULL;
}
return m_iconWnd != NULL;
}
+// Destroy event from wxTaskBarIconArea
+void wxTaskBarIcon::OnDestroy(wxWindowDestroyEvent&)
+{
+ // prevent crash if wxTaskBarIconArea is destroyed by something else,
+ // for example if panel/kicker is killed
+ m_iconWnd = NULL;
+}
+
bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
{
wxBitmap bmp;
bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
{
wxBitmap bmp;
m_iconWnd = new wxTaskBarIconArea(this, bmp);
if (m_iconWnd->IsOk())
{
m_iconWnd = new wxTaskBarIconArea(this, bmp);
if (m_iconWnd->IsOk())
{
+ m_iconWnd->Connect(wxEVT_DESTROY,
+ wxWindowDestroyEventHandler(wxTaskBarIcon::OnDestroy),
+ NULL, this);
m_iconWnd->Show();
}
else
m_iconWnd->Show();
}
else