Check for view presence in wxDocument::RemoveView()
Return false and avoid calling OnChangedViewList() if the view wasn't present in the first place. This is not, strictly speaking, backwards compatible, but most of the existing code doesn't seem to check the return value of RemoveView() at all and it's hard to imagine that someone would rely on it returning true when removing a non-existent view, so in practice this changes seems to be safe. Closes #17888.
This commit is contained in:
@@ -570,7 +570,9 @@ bool wxDocument::AddView(wxView *view)
|
||||
|
||||
bool wxDocument::RemoveView(wxView *view)
|
||||
{
|
||||
(void)m_documentViews.DeleteObject(view);
|
||||
if ( !m_documentViews.DeleteObject(view) )
|
||||
return false;
|
||||
|
||||
OnChangedViewList();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user