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

TArrays cause crashes when freed #28

Open
Matt-Hurd opened this issue Apr 26, 2019 · 2 comments
Open

TArrays cause crashes when freed #28

Matt-Hurd opened this issue Apr 26, 2019 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Matt-Hurd
Copy link
Collaborator

TArrays are more complicated than a simple struct. Simply malloc and freeing them causes issues, so we need to hook into the init from UE.

@Matt-Hurd Matt-Hurd added bug Something isn't working enhancement New feature or request labels Apr 26, 2019
@apple1417 apple1417 changed the title Hook into UE functions for TArrays TArrays cause crashes when free Feb 4, 2021
@apple1417 apple1417 changed the title TArrays cause crashes when free TArrays cause crashes when freed Feb 4, 2021
@apple1417
Copy link
Contributor

apple1417 commented Feb 4, 2021

Coalescing examples from duplicates:

namePart = unrealsdk.FindObject(
    "ItemNamePartDefinition",
    "GD_ClassMods.Prefix_Assassin.Prefix_Infiltrator_00_Infiltrator"
)
namePart.PartName = "Infilbooper"

# Crash
unrealsdk.GetEngine().GamePlayers[0].Actor.ConsoleCommand(
    "set GD_ClassMods.Prefix_Assassin.Prefix_Infiltrator_00_Infiltrator PartName Infiltrator",
    0
)
obj1 = unrealsdk.FindObject("MissionDefinition", "GD_Anemone_Side_VaughnPart2.M_Anemone_VaughnPart2")
obj2 = unrealsdk.FindObject("WeaponTypeDefinition", "GD_Weap_Pistol.A_Weapons.WeaponType_Jakobs_Pistol")
obj3 = unrealsdk.FindObject("SkillDefinition", "GD_Assassin_Skills.Bloodshed.Execute")
obj4 = unrealsdk.FindObject("ItemPoolDefinition", "GD_CustomItemPools_Lilac.Psycho.BlueBold")

# Each line here causes a crash
obj1.Dependencies = obj1.Dependencies
obj2.WeaponIdleAnimations = obj2.WeaponIdleAnimations
obj3.SkillConstraints = obj3.SkillConstraints
obj4.BalancedItems = obj4.BalancedItems

@apple1417
Copy link
Contributor

Another concern is that we're probably not deallocating the existing array properly before assinging a new one, leading to a memory leak.

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

No branches or pull requests

2 participants