Skip to content

Conversation

@FileEX
Copy link
Member

@FileEX FileEX commented Dec 7, 2024

Fixed #3876

The crash occurs in the function CEntity::RegisterReference because, at the moment of creating an explosion for a projectile, for an unknown reason, the memory where the projectile's creator (the player disconnecting from the server) is located is freed and becomes 0x80808080. I haven’t investigated the cause of where and why the memory is being freed before the projectile is destroyed. In any case, removing projectiles without the explosion resolves the crash. Besides, the explosion during the server quit doesn’t make sense anyway because we can't see it

Comment on lines +51 to +52
if (!projectileInfoInterface->pEntProjectileOwner || projectileInfoInterface->pEntProjectileOwner->nType == ENTITY_TYPE_NOTHING || projectileInfoInterface->pEntProjectileOwner->pReferences == reinterpret_cast<void*>(0x80808080))
bBlow = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to find a reason why pEntProjectileOwner was freed.
It looks like MTA doesn't delete all projectiles while disconnecting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the goal of this PR. This PR is only a temporary solution to prevent the game from crashing. If you want, feel free to investigate the cause and open a PR with the fix, and then I'll close mine. For now, this PR is just a temporary crash patch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary solutions have a high chance to become permanent.
The solution is too dirty. We don't rush with this issue.

@FileEX FileEX changed the title Fix projectiles crash during disconnecting #3876 Temporary fix projectiles crash during disconnecting #3876 Dec 7, 2024
@FileEX FileEX closed this Dec 7, 2024
@FileEX FileEX deleted the bugfix/projectiles_disconnection_crash branch December 7, 2024 16:40
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.

createProjectile crashes the game after quitting / getting kicked

3 participants