I am using a lot of linked lists in my prog and usually apply a certain procedure to deallocate them when no longer needed. But with this one list, this does not work. It sends my program crashing with the message 'debug assertion failed' from windows VisualC++ library.
the code, that has worked with dozens of other lists is
This is supposed to set the temporary pointer to the head of the list (1), then, while it is associated, it is set to the next element. The head of the list gets deallocated (4) and the head-pointer is then set to the temporary pointer (5). Then, as long as the temporary pointer (and headpointer) are allocated the loop runs, deleteing the linked list from head to tail. Finally the tail gets nulliffied.
In this occasion however I get the a.m. error on the first deallocation of the head-pointer. When running in the debugger I can witness, that after execution of line (3) the headpointer is still pointing to valid data, but still the prog crashes in line (4). (The debugger moves to some assembler code then that I could not make head or tail of). The crash is that hard, that I do not get any information from the stat = irslt clause when I tried to check the returned value (these lines are not shown here).
What could be the problem here ?
Norbert
The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.
the code, that has worked with dozens of other lists is
Code:
ppTPTTemp => ppTPTHead !(1)
do while (associated (ppTPTTemp)) !(2)
ppTPTTemp => ppTPTTemp.pNext !(3)
deallocate (ppTPTHead, stat = irslt) !(4)
ppTPTHead => ppTPTTemp !(5)
enddo !(6)
nullify (ppTPTTail) !(7)
This is supposed to set the temporary pointer to the head of the list (1), then, while it is associated, it is set to the next element. The head of the list gets deallocated (4) and the head-pointer is then set to the temporary pointer (5). Then, as long as the temporary pointer (and headpointer) are allocated the loop runs, deleteing the linked list from head to tail. Finally the tail gets nulliffied.
In this occasion however I get the a.m. error on the first deallocation of the head-pointer. When running in the debugger I can witness, that after execution of line (3) the headpointer is still pointing to valid data, but still the prog crashes in line (4). (The debugger moves to some assembler code then that I could not make head or tail of). The crash is that hard, that I do not get any information from the stat = irslt clause when I tried to check the returned value (these lines are not shown here).
What could be the problem here ?
Norbert
The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.