Skip to content

[core] Fix crash when constructing an air absorption model with a callback#521

Merged
lakulish merged 1 commit intoValveSoftware:masterfrom
wolframw:fix_519
Feb 19, 2026
Merged

[core] Fix crash when constructing an air absorption model with a callback#521
lakulish merged 1 commit intoValveSoftware:masterfrom
wolframw:fix_519

Conversation

@wolframw
Copy link
Copy Markdown
Contributor

fixes #519

@MaxenceMaire
Copy link
Copy Markdown
Contributor

Just tested this fix and can confirm it resolves the segfault.

My minimal test case from #519 now passes:

Starting test...
Context create returned: 0
About to call iplAirAbsorptionCalculate...
Callback called: distance=10.000000, band=0
Callback called: distance=10.000000, band=1
Callback called: distance=10.000000, band=2
Success! Results: 0.000000, 0.000000, 0.000000

The callback is being invoked correctly and no more crashes. I initially thought this was a C struct initialization issue on my end, but turns out the constructor was unconditionally dereferencing the coefficients pointer even when it might not be valid during the C-to-C++ conversion.

@lakulish lakulish merged commit 567d658 into ValveSoftware:master Feb 19, 2026
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.

Segmentation fault in iplAirAbsorptionCalculate when using IPL_AIRABSORPTIONTYPE_CALLBACK

3 participants