mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

createBuilding crash 0x000096AD

Open Xenius97 opened this issue 5 months ago • 10 comments

Describe the bug

createBuilding crash

Steps to reproduce

  1. Use createBuilding()
  2. Fly around the map

Version

Multi Theft Auto v1.6-release-22410

Additional context

https://mega.nz/file/wQRUDZYB#NHP447diX6cCtgr7Yu8MuI96P_CjWKa4kQQx7M6Q7fM

Relevant log output

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

Xenius97 avatar Mar 01 '24 11:03 Xenius97

I was only able to reproduce it when I created a lot of buildings at once.

Nico8340 avatar Mar 01 '24 12:03 Nico8340

I see that when the error message about running out of slots appears, the game crashes. Otherwise, not really.

Nico8340 avatar Mar 01 '24 12:03 Nico8340

I was only able to reproduce it when I created a lot of buildings at once.

Same crash with 5 and 2000 buildings. I've created 5 buildings (cityhall ls), and crashed at chilliad wood house

Xenius97 avatar Mar 01 '24 12:03 Xenius97

@Xenius97 can you provide test resource, please? I knew about crashes with more than 2000 buildings, but it always works well for me with 5 buildings

TheNormalnij avatar Mar 01 '24 18:03 TheNormalnij

removeWorldModel(3997, 10000, 0, 0, 0)
removeWorldModel(4045, 10000, 0, 0, 0)
createBuilding(3997, 1479.3359375, -1802.2890625, 12.546875, 0, 0, 0)
removeWorldModel(4163, 10000, 0, 0, 0)
removeWorldModel(4164, 10000, 0, 0, 0)
createBuilding(4163, 1469.3359375, -1732.2890625, 12.4609375, 0, 0, 0)
removeWorldModel(4186, 10000, 0, 0, 0)
removeWorldModel(4057, 10000, 0, 0, 0)
createBuilding(4186, 1479.5546875, -1693.140625, 19.578125, 0, 0, 0)
removeWorldModel(3985, 10000, 0, 0, 0)
removeWorldModel(4210, 10000, 0, 0, 0)
createBuilding(3985, 1479.5625, -1631.453125, 12.078125, 0, 0, 0)
removeWorldModel(3978, 10000, 0, 0, 0)
removeWorldModel(4053, 10000, 0, 0, 0)
createBuilding(3978, 1380.265625, -1655.5390625, 10.8046875, 0, 0, 0)
removeWorldModel(4029, 10000, 0, 0, 0)
removeWorldModel(4136, 10000, 0, 0, 0)
createBuilding(4029, 1629.546875, -1756.0859375, 8.09375, 0, 0, 0)

Xenius97 avatar Mar 02 '24 10:03 Xenius97

Tried to reproduce again, but i can't. I don't know what was wrong, maybe not buildings.

Xenius97 avatar Mar 05 '24 17:03 Xenius97

Found the issue. Create a few buildings in one resource, then restart it a few times and crash.

Xenius97 avatar Mar 06 '24 16:03 Xenius97

I hope #3330 fixes this case too.

TheNormalnij avatar Mar 06 '24 16:03 TheNormalnij

@TheNormalnij You could try clearing the references to the building perhaps. (See CEntity::ResolveReferences)

Pirulax avatar Mar 06 '24 19:03 Pirulax

@TheNormalnij okay, so I've looked into the crash log, and it's here: https://github.com/gta-reversed/gta-reversed-modern/blob/e3219aeccec725c939c13f27e9ecd338d70e5b8d/source/game_sa/Streaming.cpp#L188 Seems like you aren't calling DeleteRwObject anywhere (which would remove the entity's streaming link).

Pirulax avatar Mar 07 '24 10:03 Pirulax