1
votes

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.

1
More code would be helpful; it's almost impossible to diagnose these kinds of problems without the context. - elixenide
@EdCottrell ok, i've uploaded it - k5f

1 Answers

0
votes

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.