Skip to content

Segmentation fault related to decals when switching sessions #326

@jspjutNV

Description

@jspjutNV

In investigating #323 I noticed a crash I've seen many times before that happens intermittently when switching sessions. This memory fault seems related to miss decals and the way we clear the memory for them with it not being managed and cleaned up correctly. While it doesn't reproduce every time, typically if you set up a session with decals allowed, fire enough times to get a few decals up, then open the menu and switch sessions, I tend to get a crash at least once in 5 attempts. I'd say roughly half of my attempts to do something like this crash.

For more details, the code that faults is the following from Weapon.cpp on the line with m_scene->remove(m_currentMissDecals.pop());:

void Weapon::clearDecals(bool clearHitDecal) {
	while (m_currentMissDecals.size() > 0) {				// Remove and clear miss decals
		m_scene->remove(m_currentMissDecals.pop());
	}
	m_missDecalTimesRemaining.clear();						// Clear miss decal timeouts

	if (clearHitDecal && notNull(m_hitDecal)) {				// Clear hit decal (if one is present)
		m_scene->remove(m_hitDecal);
	}
}

This isn't the only type of crash I've seen and occasionally it claims that an Array larger than 2^32 isn't allowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions