fix(gta/streaming): don't resolve game packfile handles when unregistering streamed files - #4111
Conversation
|
Muito bom fivem te amooooooooooooooo muitoooooooooooooioooooooo fivem |
…ering streamed files When a streamed file overrides an already-registered base-game asset, the asset's handle stack keeps the original game packfile handle alongside the cfx raw handle. CfxCollection_RemoveStreamingTag walked that stack and called GetEntryName() on every entry, including the game handle. During a session teardown that destroys collections before resources unmount - as Rockstar Editor activation does - that dereferences freed collection state and crashes. Guard the compare with streaming::IsRawHandle(), matching the check the registration path already performs, and null-check the streamer. A resource cache path can never equal a game packfile entry name, so the skipped compares could not have matched. Also fixes a pre-existing iterator bug in the same loop: `it = erase(it)` inside a `for (...; ++it)` skipped the following element and incremented past end() when the erased element was last. Signed-off-by: TheMadGriffin <themadgriffin0@gmail.com>
940ae7d to
99e3d42
Compare
|
Hey! Quick question, and absolutely no offense intended. Is there a linked issue or existing report for this PR that I could take a look at? Also, I may be completely wrong here, but the PR description reads a little AI-assisted to me. Was AI used anywhere while putting this together? Not asking as a criticism at all, just curious about the context and how the PR was prepared. |
|
Hey Valerisn! No offense at all! I opened this PR to resolve the long standing issue of Rockstar editor crashing when launched from in game. There have been quite a few issues opened for it. Here is one: #3389 I did use Claude Fable 5 to aid in putting this together and manually reviewed the description and code. I apologize if that is not permissible. |
|
No no its alright, I get Writing Documentation with AI, was just curious thats all |
It's crazy how good some of these tools are getting. I appreciate you taking the time to look at my PR. |

Goal of this PR
Fix a reliably reproducible client crash when entering the Rockstar Editor while connected to
any server that streams a file overriding a base-game asset (occlusion ymaps,
v_int_*ytypsand similar — very common on roleplay servers).
Crash signature:
EXCEPTION_ACCESS_VIOLATIONreading0x10atGTA5_b3570.exe+1357D4F,called from
gta-streaming-five.dll+440AD, legacy hashsummer-football-princess.This is very likely the mechanism behind the long-standing scattered reports of "the Rockstar
Editor always crashes on server X but works on server Y" — whether a server happens to stream
a base-asset override decides it.
How is this PR achieving the goal
When a streamed file overrides an asset that is already registered,
LoadStreamingFile.cpppushes the original game packfile handle (collection index >= 2) onto
g_handleStackbefore overwriting the entry, then pushes the new cfx raw handle on top:
The handle stack therefore legitimately contains handles the cfx raw streamers do not own.
The registration path already accounts for this and guards raw streamer access:
The matching unregistration path in
CfxCollection_RemoveStreamingTaghas no such guard —it walks the whole stack and unconditionally does:
Rockstar Editor activation forces a disconnect whose session shutdown destroys the base
packfile collections before resources unmount. By the time the unregister loop runs,
resolving a saved game handle dereferences freed collection state.
This PR applies the same ownership check the registration side already uses, and null-checks
the returned streamer. No behaviour is lost by skipping non-raw handles:
fileis a resourcecache path, so it can never string-compare equal to a game packfile entry name — those
compares were dead in healthy runs and fatal during teardown.
The loop rewrite also fixes a pre-existing iterator bug, independent of the crash: the
original
it = handleData.erase(it)inside afor (...; ++it)header skipped the elementfollowing each erasure, and incremented past
end()when the erased element was the last one.The RDR3 branch is behaviourally unchanged.
Crash evidence (4 minidumps, one client, one server)
GTA5_b3570.exe+1357D4F, called fromgta-streaming-five.dll+440AD; thecrashing frame's locals contain
cs6_occl_00(an occlusion ymap override).GTA5_b3570.exe+1357D38(same function), locals containv_int_1.ytyp(a base interior ytyp override) — different session, different first override in unmount
order.
RAX = 0, AV read at0x10.had been deleted before activation as a mitigation attempt and the crash reproduced
identically, so world entity state is not a factor.
still being alive at that point.
Dumps available on request.
Repro: connect to a server streaming any file whose name collides with a base-game asset
(a
*_occl_*.ymapfrom any free MLO is the easiest source), then triggerACTIVATE_ROCKSTAR_EDITOR. The client crashes during the resource unmount followingHS_FORCE_DISCONNECT, before the editor appears.This PR applies to the following area(s)
FiveM
Successfully tested on
Game builds: 3570
Platforms: Windows
Testing status — please read. This compiles clean with no new warnings, and the root cause
is established from four minidumps plus source analysis. I have not been able to complete
a runtime before/after run: a locally built
gta-streaming-five.dllis rejected when droppedinto a retail client — the component loader deletes
content_index.xmlon the failed load andthe launcher's updater then restores the stock DLL on next start — so I could not get a
self-built component to load in a stock install to do the comparison.
If a maintainer with a dev-signed client can run it, the repro above is deterministic and
takes under a minute. Stock crashes every time; the patched build should enter the editor
cleanly. Happy to provide the dumps, the server-side repro setup, or to make any changes
requested.
Checklist