Skip to content

[Vanilla fix] Fix terrain types freeing cached SHP image references - #2459

Open
Krisztiaan wants to merge 1 commit into
Phobos-developers:developfrom
Krisztiaan:fix/terrain-image-lifetime
Open

Krisztiaan wants to merge 1 commit into
Phobos-developers:developfrom
Krisztiaan:fix/terrain-image-lifetime

Conversation

@Krisztiaan

Copy link
Copy Markdown

What kind of change is this?

  • New feature, vanilla bugfix or enhancement of a released feature - changelog, docs and credits entries are needed.

Description

TerrainType destructors can delete SHP references still retained by the FileSystem cache. Subsequent mission restarts can reuse the freed memory and corrupt unrelated data. This was reproduced in Global Crisis’s TUTO4 after two in-game restarts.

Clear borrowed SHP references before native deletion in both terrain destructor paths. Owned images and raw theater images retain their existing cleanup behavior.

An equivalent standalone correction passed two in-game restarts under Wine with the full campaign DLL set.

@Krisztiaan Krisztiaan changed the title Fix terrain types freeing cached SHP image references [Vanilla fix] Fix terrain types freeing cached SHP image references Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Coronia Coronia added ❓Vanilla bug Vanilla game bugs that are requested to be fixed ⚙️T1 T1 maintainer review is sufficient No test needed This PR is simple enough, or changes no in-game logic, so no in-game testing is required. labels Oct 8, 2026
@Coronia
Coronia requested a review from NetsuNegi October 8, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No test needed This PR is simple enough, or changes no in-game logic, so no in-game testing is required. ⚙️T1 T1 maintainer review is sufficient ❓Vanilla bug Vanilla game bugs that are requested to be fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants