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

Calling engineFreeModel right after destroying custom content causes crash #3383

Open
1 task done
ffsPLASMA opened this issue May 9, 2024 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@ffsPLASMA
Copy link

ffsPLASMA commented May 9, 2024

Describe the bug

When calling engineFreeModel right after destroying custom loaded content associated with that ID causes following crash:

Version = 1.6-release-22388.0.000
Time = Thu May 9 19:24:39 2024
Module = C:\Program Files (x86)\MTA San Andreas 1.6\mods\deathmatch\client.dll
Code = 0xC0000005
Offset = 0x0002C089

EAX=00000000 EBX=330CE040 ECX=00000000 EDX=000066CC ESI=4DAB0268
EDI=5946E5A0 EBP=0177F930 ESP=0177F914 EIP=58A2C089 FLG=00210246
CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B

Steps to reproduce

  1. request new ID, load custom TXD/DFF/COL to that ID
  2. destroy the custom content elements, then call engineFreeModel

Example:

-- destory TXD/DFF/COL elements
for _, uCustomContent in pairs(tblContentCache) do
if(isElement(uCustomContent)) then
destroyElement(uCustomContent);
end
end

-- free ID
for _, iNewEngineID in pairs(tblModelNameToAllocatedID) do
engineFreeModel(iNewEngineID);
end

Version

Client: 1.6-release-22388.0.000

Additional context

There is a workarround I figured out. Simply putting a small timer between these two actions solves the crash.

-- destory TXD/DFF/COL elements
for _, uCustomContent in pairs(tblContentCache) do
if(isElement(uCustomContent)) then
destroyElement(uCustomContent);
end
end

-- small delay to fix crash
setTimer(function()
-- free ID
for _, iNewEngineID in pairs(tblModelNameToAllocatedID) do
engineFreeModel(iNewEngineID);
end
end, 10, 1);

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@ffsPLASMA ffsPLASMA added the bug Something isn't working label May 9, 2024
@TheNormalnij
Copy link
Contributor

i think the crash was fixed in #3357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants