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

fix: crash related to getName methods with deleted creature #1080

Merged

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented May 8, 2023

Description

Because they are classes with virtual implementations, after the creature is deleted it crashes when trying to access the wrong getName methods. Doing the manual implementations of each class solves the problem of crashing in an addEvent lua.

Resolves #513

Behaviour

Actual

Crashes when trying to access a monster/player that has already been deleted from memory through the lua Creature(name or id) method.

Expected

No more crash.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Because they are classes with virtual implementations, after the creature is deleted it crashes when trying to access the wrong getName methods. Doing the manual implementations of each class solves the problem of crashing in an addEvent lua.
@dudantas dudantas merged commit 01fe001 into opentibiabr:main May 9, 2023
@dudantas dudantas deleted the fix-crash-related-to-use-memory-freed branch May 9, 2023 00:12
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 9, 2023

Please retry analysis of this Pull-Request directly on SonarCloud.

luan pushed a commit that referenced this pull request Jul 11, 2023
Because they are classes with virtual implementations, after the creature is deleted it crashes when trying to access the wrong getName methods. Doing the manual implementations of each class solves the problem of crashing in an addEvent lua.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Segmentation fault on Creature::GetName function]
5 participants