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 deletion of uninitialized pointer #435

Merged
merged 1 commit into from Jan 28, 2023

Conversation

jrbaxter0
Copy link
Contributor

If a ChVisualSystemIrrlicht is constructed, then destructed without initializing, a segfault is caused due to deleteing the uninitialized m_receiver pointer. This fixes the problem.

It might be more elegant to instead initialize m_pointer with nullptr then check that here, but this seemed less invasive.

@jrbaxter0 jrbaxter0 changed the title Fix deletion of unitialized pointer Fix deletion of uninitialized pointer Jan 18, 2023
@rserban
Copy link
Member

rserban commented Jan 18, 2023

Thanks for the fix.! I actually would prefer initializing m_receiver to nullptr. Would you mind amending the PR?
Oh, and while you're at it, please move the definition of the destructor right after the constructor. :-)

@jrbaxter0
Copy link
Contributor Author

Should be all set

@rserban rserban merged commit 203babb into projectchrono:main Jan 28, 2023
@jrbaxter0 jrbaxter0 deleted the patch-ChIrrGUI-destructor branch January 30, 2023 21:30
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.

None yet

2 participants