Skip to content
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

Crash when calling python Usd.Prim.IsDefined() on a null prim #753

Closed
marktucker opened this issue Jan 24, 2019 · 3 comments
Closed

Crash when calling python Usd.Prim.IsDefined() on a null prim #753

marktucker opened this issue Jan 24, 2019 · 3 comments

Comments

@marktucker
Copy link
Contributor

Description of Issue

When you have a null prim object in Python, calling almost any method on it throws a python exception. A few methods (like IsValid()) return values. But IsDefined() crashes the applications

Steps to Reproduce

  1. Open any USD file in usdview.
  2. In the Interpreter window run:
    p = usdviewApi.stage.GetPrimAtPath('/not_a_prim')
    p.IsDefined()
  3. usdview crashes

This is because in usd/wrapObject.cpp, in getattribute, there is a specific test done for a few method names. One of which is "IsDefined". This check allows the IsDefined method to be run even if the primitive is invalid (just as it allows IsValid() to return False instead of raising an exception). Every other Prim method (IsActive for example) raises an exception. The simple solution, I believe, is to just remove IsDefined from this list. But it's possible that this method really should be in this list, in which case I thinkit's implementation in wrapPrim.cpp needs to be changed to explicitly check for the null prim case?

The actual "crash" is caused in Usd_PrimDataHandle::operator->, where it calls UsdIssueFatalPrimAccessError().

@spiffmon
Copy link
Member

Thanks, @marktucker ! I'd vote for removing IsDefined from the whitelist, since its behavior relies on the presence of authored scene data, but would like for @gitamohr to weigh in.

@jtran56
Copy link

jtran56 commented Jan 29, 2019

Filed as internal issue #USD-5045.

@spitzak
Copy link

spitzak commented Jan 29, 2019 via email

francis-wangfr pushed a commit to autodesk-forks/USD that referenced this issue Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants