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

Fixes an issue on layer editor save dialog, where an invalid extension could cause a crash. The fallback is .usd. #2845

Merged
merged 3 commits into from
Jan 26, 2023

Conversation

AramAzhari-adsk
Copy link
Collaborator

When an invalid extension string is provided, USD fails to relocate the file when trying update the cached stage layers and will return a TfNullPtr which results in crash. The fix is to check and update the file path prior to passing to layer export and load operations.

…n could cause a crash. The fallback is .usd.
@pierrebai-adsk
Copy link
Collaborator

pierrebai-adsk commented Jan 25, 2023

Given your description of the problem, the fact that it caused crashes, while the code you fixed did not use the invalid null pointer, makes me think that it initially crashed in the caller? I see that it was called in layerManager.cpp, which passed the returned layer pointer to SetEditTarget(), which is where I assume it eventually crashed.

So I'd also add a check for null in layerManager.cpp (possibly with an error log). While you fixed one cause why the returned layer can be null, there might be others we don't know about. I think it would be nice to make the caller handle the null case.

PS: after trying it, it seems the crash was in updateAllCachedStageWithLayer, which uses the new layer pointer without checking if it is null.

Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I wrote, I believe we should fix the caller too.

…where the file cannot be opened after it was exported. The user is then displayed a message dialog indicating the layer saving was not successful.
@AramAzhari-adsk AramAzhari-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 26, 2023
@seando-adsk seando-adsk merged commit 6191dc8 into dev Jan 26, 2023
@seando-adsk seando-adsk deleted the azharia/MAYA-127243/usd-layer-editor-save-crashfix branch January 26, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants