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

Fix crash on extension reload #673

Merged
merged 3 commits into from
Feb 12, 2024
Merged

Fix crash on extension reload #673

merged 3 commits into from
Feb 12, 2024

Conversation

lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Feb 9, 2024

Creating a Fabric prim with the same path as a previously destroyed prim causes a crash. Previously this was avoided by including the object id and pool id in the name, but on extension reload the pool id is initialized to 0 and new paths may conflict with old paths.

Now a contextId is randomly generated and ensures that Fabric prim paths are unique even across extension reloads.

There are probably more robust and safer ways to do this than glm::linearRand<int64_t>(0, 100000), like using a timestamp, but since extension reloads are uncommon and I didn't want to overcomplicate this.

With the fix applied the extension no longer crashes when disabled and re-enabled:

extension-reload.mp4

Copy link
Contributor

@corybarr corybarr left a comment

Choose a reason for hiding this comment

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

Simple and clean.

My goto-for these issues has been a timestamp like you mention in a one-liner. I don't think it would add any real amount of complexity if you were to drop it in. But the odds of a name-collision crash are also insignificant.

@lilleyse
Copy link
Contributor Author

I switched to a timestamp; it's a better solution.

Base automatically changed from fix-scene-reload-crash to main February 12, 2024 22:26
@lilleyse lilleyse enabled auto-merge February 12, 2024 22:26
@lilleyse lilleyse merged commit f3ed1be into main Feb 12, 2024
3 checks passed
@lilleyse lilleyse deleted the fix-extension-reload-crash branch February 12, 2024 22:43
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

Successfully merging this pull request may close these issues.

2 participants