Fix a potential crash when updating skinned primitives. #2931
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes the crash reported in #2809, which contains the example file and steps to reproduce.
We've had this patch in Houdini for a couple weeks and haven't encountered any issues in testing
Description of Change(s)
With 6b3afc2, skinned primitives are now replaced by an entry with no type and no data source instead of being removed, since they have child prims (the skinning computation Sprims).
When doing so, the entry's cache of computed primvars was never cleared.
This could result in a crash in scenarios such as switching to displaying the result of a BakeSkinning operation. In this case, the skinned primitive changes type from e.g. a Mesh (with a computed primvar for the skinned positions) to empty, and then back to Mesh (which should have no computed primvars). Since the entry's primvar cache was never cleared, this incorrectly returns a stale list of computed primvars for the updated mesh which later produces a crash.
When the prim type of an existing entry is being changed, the cached primvars are now also cleared out while removing the old prim from the render index, to produce the same behaviour as if a new entry was inserted
Fixes Issue(s)