-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAYA-106376: fix undo/redo re-parenting crash due to accessing a stale prim. #772
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! In general, any command which stores UFE scene items (or USD prims, same issue) is suspicious.
I think you should simply remove the _ufeSrcItem and _ufeDstItem data members, because they are no longer useful, and doing this would completely remove the possibility of relying on stale prims. Just use local variables where UFE scene items are needed.
@@ -124,16 +124,20 @@ bool UsdUndoInsertChildCommand::insertChildRedo() | |||
bool status = SdfCopySpec(_childLayer, _usdSrcPath, _parentLayer, _usdDstPath); | |||
if (status) | |||
{ | |||
// we shouldn't rely on UsdSceneItem to access the UsdPrim since | |||
// it could be stale. Instead we should get the USDPrim from the Ufe::Path | |||
const auto& desPrimUsd = ufePathToPrim(_ufeDstPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same a line 164: this will give the wrong stage at line 134.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming nit-pick: should use "dst" or "des" prefix for "destination", but not both.
Good point but we can't remove _ufeDstItem since it needs to be passed to insertedChild(). For now, I removed _ufeSrcItem since it serves no purpose to be stored. Addressed in c29d1e4 |
This PR addresses the random undo/redo crash after performing multiple re-parenting operations.