PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Object Dependency question  (Read 948 times)

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Object Dependency question
« on: June 04, 2021, 05:10:25 PM »
I have been using business logic objects that instantiate other objects "FOR OBJECT" .  As it is convenient, I occasionally make the internal object handles available as properties with SET ERR rather than opening two instances. 
Now I'm wondering if the shutdown of these objects used outside the container object might be responsible for the occasional segment fault I get in testing? 

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Object Dependency question
« Reply #1 on: June 04, 2021, 05:45:27 PM »
One issue we often see with complex object interdependencies is objects that relay on other objects in order to complete their "On_delete" logic.

When you exit PxPlus with objects still active, the system attempts to close all the objects however it has no idea of the order your application may require in order to shutdown properly.  Internally it attempts to delete objects starting from the most recently created ones first based on their reference count but that may not always work or be viable.

We have seen, sadly on numerous occasions, objects that when being deleted access resources on other objects without regard as to whether the other object still exists.  This often results in some form of error trap which in itself may reference objects that are no longer present.

Care should be taken to always check in that any object deletion logic that relies of external objects first checks that the object is still present and handles it appropriately.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Re: Object Dependency question
« Reply #2 on: June 04, 2021, 06:18:06 PM »
I do pass objects as well which are not referenced in the on_delete. 
Is the shutdown of the object on error capable of shutting down the passed object?
For objects which end up with nothing in the On_Delete procedure, is there any benefit to removing the DELETE REQUIRED and the On_Delete procedure other than debugging convenience?