Monday, October 21, 2013

Program – Error Handling Issues

When checking for memory errors, a use of uninitialized memory error was detected with new encoder test #2.  The problem occurred in the remove error routine, which was always adjusting the rest of the errors after the current line.  It should have only been doing this if the line was not deleted and did not have an error.  Because this routine did not return for this condition, the error index loop variable was not initialized causing the memory error.

When the update error routine was modified back to not returning the status of whether the line has an error, the routine was not changed back to its original code correctly.  This caused errors not to be added to the errors list and therefore did not show up when running the GUI.  The routine was put back to its original code from an earlier commit.

When a line was replaced with an empty line (for example, a line with an error), the replace line routine of the new LineInfoList class was supposed to call the remove line routine and then return.  Instead if was calling the base QList class remove routine and not returning.  This caused extra code to be removed from the program.

A line with an error was added as a replacement line to encoder test #2 to verify the corrections described above.  The offset for a line with an error was added to the test output to verify that errors lines are added to the program correctly.  The offset is needed for when the line with the error is replaced with good code.

[commit d8ef155e5e]