Fixed dangling pointers bug; radio button was not removing itself from
the cycle when deleted, so when deleting and then adding a radio button, we get a crash git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35182 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -54,6 +54,12 @@ wxGTK:
|
|||||||
- Added support for left, centre and right text alignment attributes under
|
- Added support for left, centre and right text alignment attributes under
|
||||||
GTK+2 multi-line text controls (Mart Raudsepp).
|
GTK+2 multi-line text controls (Mart Raudsepp).
|
||||||
|
|
||||||
|
wxMac:
|
||||||
|
|
||||||
|
- Automatic menu management improved.
|
||||||
|
- Fixed crash when wxRadioButton is deleted from a group of radio buttons,
|
||||||
|
due to dangling cycle pointers.
|
||||||
|
|
||||||
wxOS2
|
wxOS2
|
||||||
|
|
||||||
- Adjustments for building with Open Watcom C++.
|
- Adjustments for building with Open Watcom C++.
|
||||||
|
@@ -31,6 +31,7 @@ public:
|
|||||||
{
|
{
|
||||||
Create(parent, id, label, pos, size, style, validator, name);
|
Create(parent, id, label, pos, size, style, validator, name);
|
||||||
}
|
}
|
||||||
|
~wxRadioButton();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxString& label,
|
const wxString& label,
|
||||||
@@ -47,6 +48,7 @@ public:
|
|||||||
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
wxRadioButton *AddInCycle(wxRadioButton *cycle);
|
wxRadioButton *AddInCycle(wxRadioButton *cycle);
|
||||||
|
void RemoveFromCycle();
|
||||||
inline wxRadioButton *NextInCycle() {return m_cycle;}
|
inline wxRadioButton *NextInCycle() {return m_cycle;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -72,6 +72,11 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRadioButton::~wxRadioButton()
|
||||||
|
{
|
||||||
|
RemoveFromCycle();
|
||||||
|
}
|
||||||
|
|
||||||
void wxRadioButton::SetValue(bool val)
|
void wxRadioButton::SetValue(bool val)
|
||||||
{
|
{
|
||||||
wxRadioButton *cycle;
|
wxRadioButton *cycle;
|
||||||
@@ -150,4 +155,20 @@ wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxRadioButton::RemoveFromCycle()
|
||||||
|
{
|
||||||
|
if (m_cycle==NULL || m_cycle == this)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Find the previous one and make it point to the next one
|
||||||
|
wxRadioButton* prev = this;
|
||||||
|
while (prev->m_cycle != this)
|
||||||
|
prev = prev->m_cycle;
|
||||||
|
prev->m_cycle = m_cycle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user