Question

I have a program that uses linked lists. It crashes with External:SIGSEGV when it gets to

new(R);R:=queue;queue:=queue.Next;dispose(R);

where I'm getting rid of the first element of the queue list, after dispose(R). What's even more weird - when I change it to queue:=queue.Next that is, just moving forward without dumping the element - it still crashes, after this command. It's worth mentioning that the value of queue.Next=nil. And when I tried just queue:=nil; it crashed too, leaving me absolutely puzzled. Can somebody help me?
Edit: I've uploaded the whole code here, relevant line is no. 128.

Was it helpful?

Solution

The problem was that I was dereferencing the pointer later and lazarus wasn't able to backtrack to that position so he pointed at the line where the pointer was set to nil.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top