Unlike Prolog, XPCE is not secure: if a Prolog environment traps a fatal error there is almost always a bug in the Prolog system. Except for violating system limits there is no Prolog program that can make the Prolog environment crash. For XPCE this is different. Consider the following example:
1 ?- new(@p, picture), send(@p, display, new(B, box(100,100))), get(B, area, Area), free(Area). Area = @ 803438, B = @803419/box
After these calls, the
<-area attribute of the
box has been destroyed, but the box is not aware of this fact. The
scans the XPCE object-base for various
inconsistencies and will report that the box contains a slot referring
to a freed object.
2 ?- checkpce. [WARNING: Freed object in slot area of @803419/box: @803438/area] [PCE: Checked 13173 objects]
XPCE uses heuristics trying to avoid that such problems actually crash the system (in the example above execution continues normally).
We advice using checkpce/0 regularly during program development to verify your application is not violating object consistency. Please see section 10.4 and section 10.11 for techniques to avoid `dangling' object references.