View Revisions: Issue #1707

Summary 0001707: Feature request: Identify and notify the user about cyclic references
Revision 2020-06-08 14:04 by jsantos
Description Hi guys,

I've recently been looking at cleaning up our shutdown code and I've fixed a few issues where a child holds a ref counted pointer to a parent object in the hierarchy. This ultimately creates a cyclic dependency between the two objects and prevents them from being cleaned up. I've attached 2 examples of code which might do this, the first is setting a DataContext to a parent object, and another is setting the TargetName on a GoToStateAction to a parent object.

It would be extremely helpful to try and detect these cases. Perhaps in debug you could assert if the TargetName or DataContext are trying to be set to a parent object in the hierarchy when you set the pointer. Or perhaps a better way is to try and find these cyclic references in shutdown if we've detected that we've leaked memory. Essentially any further information to help track these issues down would be extremely beneficial!

Cheers.
Revision 2020-05-28 11:37 by steveh
Description Hi guys,

I've recently been looking at cleaning up our shutdown code and I've fixed a few issues where a child holds a ref counted pointer to a parent object in the hierarchy. This ultimately creates a cyclic dependency between the two objects and prevents them from being cleaned up. I've attached 2 examples of code which might do this, the first is setting a DataContext to a parent object, and another is setting the TargetName on a GoToStateAction to a parent object.

It would be extremely helpful to try and detect these cases. Perhaps in debug you could assert if the TargetName or DataContext are trying to be set to a parent object in the hierarchy when you set the pointer. Or perhaps a better way is to try and find these cyclic references in shutdown if we've detected that we've leaked memory. Essentially any further information to help track these issues down would be extremely beneficial!

Cheers.