Open calvertdw opened 1 year ago
Typically, the frame gets removed for garbage collection, this was not intended to be a feature allowing a frame to be added and then removed by hand really. I'm getting the feel that you're trying to use the remove thingy in a particular way and we should prob do an iteration on the class to support that properly. Can you expand on what you're trying to do?
Sneaky workaround
private static final Field referenceFrameHasBeenRemoved;
static
{
try
{
referenceFrameHasBeenRemoved = ReferenceFrame.class.getDeclaredField("hasBeenRemoved");
referenceFrameHasBeenRemoved.setAccessible(true);
}
catch (NoSuchFieldException e)
{
throw new RuntimeException(e);
}
}
public static boolean hasBeenRemoved(ReferenceFrame referenceFrame)
{
try
{
return referenceFrameHasBeenRemoved.getBoolean(referenceFrame);
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
}
Two improvements would help:
There's not way to check if a ReferenceFrame has been removed from the tree in order to handle that case properly. The only option currently is
checkIsRemoved
which is protected and throws a RuntimeException.