Have not observed any such thing, and I couldn't guess why GetCount() would crash, either (don't get me started on wxWidgets, lol).
However, we don't really need to know the count anyway. All we do is count down to zero and check whether it is really zero. This can be implemented more efficiently:
bool cbProject::SaveAllFiles()
{
bool feelGood = true;
FilesList::Node* node = m_Files.GetFirst();
while(node)
{
ProjectFile* f = node->GetData();
if (!Manager::Get()->GetEditorManager()->Save(f->file.GetFullPath()))
feelGood = false;
node = node->GetNext();
}
return feelGood;
}
That will 99.9% certain not fix your problem (as the call to GetCount() actually cannot be the cause), but try it nevertheless :)
[code]
bool cbProject::SaveAllFiles()
{
int count = m_Files.GetCount();
FilesList::Node* node = m_Files.GetFirst();
while(node)
{
ProjectFile* f = node->GetData();
if (Manager::Get()->GetEditorManager()->Save(f->file.GetFullPath()))
--count;
node = node->GetNext();
}
return count == 0;
}
My guess: m_Files is not checked to see if it's 0x0. That's usually the cause of crashes in wxWidgets calls like this.
[/code]
Thomas!
It happend again (horray :?). With your patch applied the same crash happened when I opened a quite large workspace with 3 projects (large in number of files). Thi I immediately tried to compile and crash boom bang!
Please notice that I've disabled the codecomletion plugin so this isn't the source.
This time the crash happens in the line:
FilesList::Node* node = m_Files.GetFirst();
again in the method bool cbProject::SaveAllFiles().Alltogether this really looks like m_Files could be a null pointer under certain customstances... What to do? Because checking all access to m_Files for a NULL pointer seems a bad solution. Why can m_Files be NULL at this point?! I don't get it...?!
With regards, Morten.