I don't have time now to test, but this should be the proper implementation:
{
FilesList::iterator it = m_Files.find(pf);
if (it == m_Files.end())
{
Manager::Get()->GetLogManager()->DebugLog(_T("Can't locate node for ProjectFile* !"));
}
else
{
if (!m_FileArray.IsEmpty())
m_FileArray.Remove(*it);
m_Files.erase(it);
}
}
I am somewhat undecided about that checking for emptiness of the array. Actually it is kind of useless code since you won't ever remove a file from a project that isn't part of the project (at least, you shouldn't ever need to?). Unless someone writes a plugin that removes
random filenames from a project or something the like, that should never happen.
On the other hand,
wxArray does not silently ignore removing an element that is not in the array as you would expect, but triggers an assertion, so if that happens... bang, you're dead. That's somewhat uncool.