Paraview crashed when deleting an added python macro from Macro Menu
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
I have compiled ParaView 3.10.1 and 3.14.0 as 32bit on Windows 7 with MS VS 2008, and I found it would crash when I tried to delete a macro I added.
After debugging for some time, I found there's bug in the following codes:
for ( ; itr != this ->Internal->DeleteActionMap.constEnd(); ++itr ) { if (itr.value() == action) { QString filename = itr.key(); pqPythonMacroSupervisor::removeStoredMacro(filename); pqPythonMacroSupervisor::removeMacro(filename); } } QMap's removing actions has different behavior on VS Compiler, and removing one element in this loop would cause dangling pointer problem.
I have changed the codes to the following(do not increment in for clauses) to fix this bug: for ( ; itr != this->Internal->DeleteActionMap.constEnd();) { if (itr.value() == action) { QString filename = (itr++).key(); pqPythonMacroSupervisor::removeStoredMacro(filename); pqPythonMacroSupervisor::removeMacro(filename); } else { ++itr; } }