Skip to content

NGMP: Use shared_ptr for WebSocket to manage its lifecycle - #58

Merged
x64-dev merged 2 commits into
mainfrom
seer/ngmp-websocket-shared-ptr
Oct 10, 2025
Merged

NGMP: Use shared_ptr for WebSocket to manage its lifecycle#58
x64-dev merged 2 commits into
mainfrom
seer/ngmp-websocket-shared-ptr

Conversation

@seer-by-sentry

@seer-by-sentry seer-by-sentry Bot commented Oct 5, 2025

Copy link
Copy Markdown

Fixes CLIENT-CD. The issue was that: Use-after-free race condition: main thread deleted WebSocket object while networking worker thread held a dangling pointer to its internal mutex.

  • Changed WebSocket* to std::shared_ptr<WebSocket> in OnlineServices_Init to manage the WebSocket object's lifecycle using RAII.
  • Modified GetWebSocket() to return std::shared_ptr<WebSocket>.
  • Replaced manual delete calls with m_pWebSocket.reset() to release the WebSocket object when it's no longer needed, ensuring proper cleanup and preventing memory leaks.
  • Updated NetworkMesh to use std::shared_ptr<WebSocket> when accessing the WebSocket instance.

This fix was generated by Seer in Sentry, triggered by x64-dev. 👁️ Run ID: 1769217

Not quite right? Click here to continue debugging with Seer.

@x64-dev
x64-dev marked this pull request as ready for review October 10, 2025 21:32
@x64-dev
x64-dev merged commit 59f7066 into main Oct 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant