Skip to content

bugfix(handles): Close leaked thread, find and file handles - #3497

Open
tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/handle-leaks
Open

tintinhamans wants to merge 1 commit into
TheSuperHackers:mainfrom
tintinhamans:arctic/fix/handle-leaks

Conversation

@tintinhamans

Copy link
Copy Markdown

asyncGethostbyname and StopAsyncDNSCheck drop the DNS lookup thread handle from CreateThread without closing it, one handle per online services check.

ImageCollection::load never closes the FindFirstFile handle it uses to look for user mapped image INIs, and winCreateFromScript leaves the layout file open when a layout block fails to parse.

All three now close their handle.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6afc08a3-0215-47ca-b790-b7c9ef771910

📥 Commits

Reviewing files that changed from the base of the PR and between 7418922 and f0cb5d9.


📒 Files selected for processing (3)
  • Core/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp
  • Core/GameEngine/Source/GameClient/System/Image.cpp
  • Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.



Walkthrough

The changes close file-search and thread handles, and close the layout input file when layout-block parsing fails.

Changes

Layout file cleanup

Layer / File(s) Summary
Close input file on parse failure
Core/GameEngine/Source/GameClient/GUI/GameWindowManagerScript.cpp
When layout-block parsing fails, the function closes inFile, clears its pointer, and returns nullptr.

Image search handle cleanup

Layer / File(s) Summary
Close file-search handle
Core/GameEngine/Source/GameClient/System/Image.cpp
ImageCollection::load retains the FindFirstFile handle and closes it when the search succeeds.

DNS thread handle cleanup

Layer / File(s) Summary
Close DNS thread handles
Core/GameEngine/Source/GameNetwork/GameSpy/MainMenuUtils.cpp
The DNS lookup completion and stop paths close their thread handles. The existing handle-reset and lookup-state behavior remains unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: xezon

Merge Risk: ⚪ Minimal · up to f0cb5

The change closes the identified layout-file, image-search, and DNS thread handles. The suspected DNS overlap is not reachable on the serialized engine loop, so no actionable merge risk remains.

Pre-merge checks · Passed 4
Passed Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely summarizes the handle leak fixes across the DNS thread, find, and file handles.
Description check Passed The description accurately explains all three handle leaks and the corresponding fixes.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the added closes preserve the existing behavior.

Summary

This PR closes resources that were previously dropped:

  • DNS checks close their thread handle when they finish or stop.
  • Image loading closes its search handle after finding user INIs.
  • Window loading closes its file when layout parsing fails.

No actionable issues were found.

Reviews (1) · Last reviewed commit: "bugfix(handles): Close leaked thread, fi..." · Reviewed by Greptile

@Mauller Mauller left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaks be gone.

@tintinhamans tintinhamans added Bug Something is not working right, typically is user facing Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Memory Is memory related labels Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Gen Relates to Generals Memory Is memory related Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants