Kode / Krom

Other
98 stars 23 forks source link

krom_load_sound(): Invalid address specified to RtlValidateHeap #146

Closed MoritzBrueckner closed 2 years ago

MoritzBrueckner commented 2 years ago

When loading a sound in Krom via kha.Assets.loadSound(), there is an error in main.cpp line 1369 (permalink):

HEAP[Krom.exe]: Invalid address specified to RtlValidateHeap( 000001F6EF450000, 00007FF6D986C9D0 )
Krom.exe has triggered a breakpoint.

The sound pointer is at address 0x00007ff6d986ca00, which is similar to the second address in RtlValidateHeap above.

Some answer on stackoverflow suggested that these errors happen if an address is freed that wasn't returned by any allocation call, so I watched the sound pointer inside of kinc_a1_sound_create() for value changes. Visual Studio then breaks in main.cpp line 1355, but the sound pointer still points to the same address, so I'm not sure why this happens. The pointer seems to be the same from it's creation until its memory is freed, so I'm not sure if this is the issue.

Then I tried to use kinc_a1_sound_destroy() like it is done in Armorcore, and even though this solves the error, the application will then run into an endless loop somewhere in Krom's kha.LoaderImpl.loadSoundFromDescription(), at least the done() callback is never called even though Krom.loadSound() finishes executing.

Using:

RobDangerous commented 2 years ago

The --sound option isn't really working yet, we already have issue #138 for that.

MoritzBrueckner commented 2 years ago

Just to make it clear, this issue also happens without the --sound param as it happens while loading a sound and not while playing it. I thought that the linked issue was only saying that the current way of doing audio is not great and temporary but that it would still work, but if that's not the case then yeah, I guess it doesn't make much sense to waste time on this issue right now.