prevent crash if panel/kicker is killed, bug 1872724
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9c8116f8f7
commit
3abc756645
@ -36,6 +36,9 @@ public:
|
||||
protected:
|
||||
wxTaskBarIconArea *m_iconWnd;
|
||||
|
||||
private:
|
||||
void OnDestroy(wxWindowDestroyEvent&);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
|
||||
};
|
||||
|
||||
|
@ -276,6 +276,14 @@ bool wxTaskBarIcon::IsIconInstalled() const
|
||||
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;
|
||||
@ -286,6 +294,9 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
||||
m_iconWnd = new wxTaskBarIconArea(this, bmp);
|
||||
if (m_iconWnd->IsOk())
|
||||
{
|
||||
m_iconWnd->Connect(wxEVT_DESTROY,
|
||||
wxWindowDestroyEventHandler(wxTaskBarIcon::OnDestroy),
|
||||
NULL, this);
|
||||
m_iconWnd->Show();
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user