Skip to content

Commit

Permalink
Prevent a crash when processing a stage update in hydra in which a pr…
Browse files Browse the repository at this point in the history
…im is

deleted from the stage, and a collection which points directly to that prim
is updated. This would crash while processing the change to the collection,
as it would access the underlying UsdPrim from the index's PrimInfo map
without checking that it is still valid. To get around this, test the
validity of the UsdPrims that show up in the affectedPrims list.
  • Loading branch information
marktucker committed Nov 2, 2018
1 parent e5c8d4f commit 35bac52
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pxr/usdImaging/lib/usdImaging/delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,15 @@ UsdImagingDelegate::_RefreshObject(SdfPath const& usdPath,
// may or may not find an associated primInfo for every prim in
// affectedPrims. If we find no primInfo, the prim that was previously
// affected by this refresh no longer exists and can be ignored.
//
// It is also possible that we find a primInfo, but the prim it refers
// to has been deleted from the stage and is no longer valid. Such a
// prim may end up in the affectedPrims during the refresh of a
// collection that previously pointed directly to a prim that has
// been deleted. The primInfo for this prim will still be in the index
// because we haven't had the index process removals yet.
if (primInfo != nullptr &&
primInfo->usdPrim.IsValid() &&
TF_VERIFY(primInfo->adapter, "%s", affectedPrimPath.GetText())) {
_AdapterSharedPtr &adapter = primInfo->adapter;

Expand Down

0 comments on commit 35bac52

Please sign in to comment.