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:
@@ -36,6 +36,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxTaskBarIconArea *m_iconWnd;
|
wxTaskBarIconArea *m_iconWnd;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnDestroy(wxWindowDestroyEvent&);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
|
DECLARE_DYNAMIC_CLASS(wxTaskBarIcon)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -276,6 +276,14 @@ bool wxTaskBarIcon::IsIconInstalled() const
|
|||||||
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)
|
bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
||||||
{
|
{
|
||||||
wxBitmap bmp;
|
wxBitmap bmp;
|
||||||
@@ -286,6 +294,9 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
|||||||
m_iconWnd = new wxTaskBarIconArea(this, bmp);
|
m_iconWnd = new wxTaskBarIconArea(this, bmp);
|
||||||
if (m_iconWnd->IsOk())
|
if (m_iconWnd->IsOk())
|
||||||
{
|
{
|
||||||
|
m_iconWnd->Connect(wxEVT_DESTROY,
|
||||||
|
wxWindowDestroyEventHandler(wxTaskBarIcon::OnDestroy),
|
||||||
|
NULL, this);
|
||||||
m_iconWnd->Show();
|
m_iconWnd->Show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user