make sure we don't have two associations pointing to the same control
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6aafd4a27a
commit
a86831340f
@ -659,7 +659,9 @@ void wxAssociateControlWithMacControl(ControlRef inControl, wxWindow *control)
|
||||
|
||||
void wxRemoveMacControlAssociation(wxWindow *control)
|
||||
{
|
||||
wxWinMacControlList.DeleteObject(control);
|
||||
// remove all associations pointing to us
|
||||
while ( wxWinMacControlList.DeleteObject(control) )
|
||||
{}
|
||||
}
|
||||
#else
|
||||
|
||||
@ -686,13 +688,22 @@ void wxAssociateControlWithMacControl(ControlRef inControl, wxWindow *control)
|
||||
void wxRemoveMacControlAssociation(wxWindow *control)
|
||||
{
|
||||
// iterate over all the elements in the class
|
||||
MacControlMap::iterator it;
|
||||
for ( it = wxWinMacControlList.begin(); it != wxWinMacControlList.end(); ++it )
|
||||
// is the iterator stable ? as we might have two associations pointing to the same wxWindow
|
||||
// we should go on...
|
||||
|
||||
bool found = true ;
|
||||
while( found )
|
||||
{
|
||||
if ( it->second == control )
|
||||
found = false ;
|
||||
MacControlMap::iterator it;
|
||||
for ( it = wxWinMacControlList.begin(); it != wxWinMacControlList.end(); ++it )
|
||||
{
|
||||
wxWinMacControlList.erase(it);
|
||||
break;
|
||||
if ( it->second == control )
|
||||
{
|
||||
wxWinMacControlList.erase(it);
|
||||
found = true ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user