Skip to content

Fix XRSound CTD (#658)#660

Open
EvESpirit wants to merge 3 commits into
orbitersim:mainfrom
EvESpirit:xrsound-deref
Open

Fix XRSound CTD (#658)#660
EvESpirit wants to merge 3 commits into
orbitersim:mainfrom
EvESpirit:xrsound-deref

Conversation

@EvESpirit
Copy link
Copy Markdown
Contributor

Fixes a null pointer dereference that causes XRSound to hard crash the entire simulation if we try to open the hatch, nosecone or retrograde thrusters.

@TheGondos
Copy link
Copy Markdown
Contributor

TheGondos commented May 18, 2026

This is likely a regression with the removal of CString strings. I'll have a look on my side too.
Edit: OK, so GetWavForAnimationState can return nullptr, then the check in LoadAndPlayWavUsingID for !pWavFile.empty() is useless because it's too late.
It can be fixed in AnimationSoundPreStep::clbkPreStep :

        case AnimationState::StateType::Opening:
        case AnimationState::StateType::Open:
        case AnimationState::StateType::Closing:
        case AnimationState::StateType::Closed:
		{
			const char *wavefile =  m_animationSounds.GetWavForAnimationState(stateType);
			if(wavefile)
	            LoadAndPlayWavUsingID(m_animationSounds.GetOpenCloseSoundID(), wavefile, false, m_animationSounds.GetPlaybackType());
            break;
		}
        case AnimationState::StateType::Moving:
		{
			const char *wavefile =  m_animationSounds.GetWavForAnimationState(stateType);
			if(wavefile)
	            LoadAndPlayWavUsingID(m_animationSounds.GetMovingSoundID(), wavefile, true, m_animationSounds.GetPlaybackType());
            break;
		}

@EvESpirit
Copy link
Copy Markdown
Contributor Author

I did that now, thanks.

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