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:
@@ -659,7 +659,9 @@ void wxAssociateControlWithMacControl(ControlRef inControl, wxWindow *control)
|
|||||||
|
|
||||||
void wxRemoveMacControlAssociation(wxWindow *control)
|
void wxRemoveMacControlAssociation(wxWindow *control)
|
||||||
{
|
{
|
||||||
wxWinMacControlList.DeleteObject(control);
|
// remove all associations pointing to us
|
||||||
|
while ( wxWinMacControlList.DeleteObject(control) )
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -686,13 +688,22 @@ void wxAssociateControlWithMacControl(ControlRef inControl, wxWindow *control)
|
|||||||
void wxRemoveMacControlAssociation(wxWindow *control)
|
void wxRemoveMacControlAssociation(wxWindow *control)
|
||||||
{
|
{
|
||||||
// iterate over all the elements in the class
|
// iterate over all the elements in the class
|
||||||
MacControlMap::iterator it;
|
// is the iterator stable ? as we might have two associations pointing to the same wxWindow
|
||||||
for ( it = wxWinMacControlList.begin(); it != wxWinMacControlList.end(); ++it )
|
// 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);
|
if ( it->second == control )
|
||||||
break;
|
{
|
||||||
|
wxWinMacControlList.erase(it);
|
||||||
|
found = true ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user