V
V
Vitaly Pukhov2015-07-09 02:39:17
Pascal
Vitaly Pukhov, 2015-07-09 02:39:17

Why can Invalid pointer operation occur in Pascal?

There is a function in Pascal-like syntax in this line, when working, an error occurs Invalid pointer operation from the description it is clear that:if oNode <> nil then FreeObject(oNode);

204 Invalid pointer operation
You will get this if you call Dispose or Freemem with an invalid pointer (notably, Nil).

That is, nil is only one of the possible options, but in this code FreeObject is a priori called only when the object is not nil, and therefore the question is what else could be wrong with the object, that it cannot be cleared and how to check it?
ps perhaps the reason is that this object was assigned to one of the elements of the list, which was cleared before clearing this object, that is, the object seems to exist, but the data no longer exists

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Martyanov, 2015-07-09
@vilgeforce

Most likely, this is how it is: calling "cleanup" twice on the same object.

R
Roman Mirilaczvili, 2015-07-09
@2ord

ps perhaps the reason is that this object was assigned to one of the elements of the list, which was cleared before clearing this object, that is, the object seems to exist, but the data no longer exists
Exactly.
It makes sense to use the FreeAndNil function inside the FreeObject implementation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question