Skip to content

fix(launcher): wait for injection thread before exit#4

Open
f1rep0wr wants to merge 1 commit into
Custom-Galactic-War:mainfrom
f1rep0wr:fix/wait-for-injection-on-close
Open

fix(launcher): wait for injection thread before exit#4
f1rep0wr wants to merge 1 commit into
Custom-Galactic-War:mainfrom
f1rep0wr:fix/wait-for-injection-on-close

Conversation

@f1rep0wr
Copy link
Copy Markdown
Contributor

If user closes the launcher during 'time.sleep(45)', InjectionThreads will be killed before data/ directory files are moved back from bin/ to data/. closeEvent already calls ensure_required_files_in_data() as a safety net, but that only recovers the three files in REQUIRED_BIN_FILENAMES (discord_game_sdk.dll, mounts.json, msvcp140.dll). Anything else that gets injected (e.g. exosuit_weapons.json) had no recovery path and stayed orphaned in bin/ forever.

Proposed fix:

  • In closeEvent, wait up to 50 seconds for injection_thread to finish before tearing the app down. The existing move-back logic completes naturally.
  • Also dropped a redundant unconditional self.rpc_manager.stop() that ran after the hasattr-guarded block.

Would still recommend CGW-Launcher warns users to not close the application mid-injection after PR merge.

…ded files

The InjectionThread runs launch_and_restore(), which moves DLLs from data/
into the game's bin/, sleeps 45s for the game to load them, then moves
them back. Closing the launcher mid-sleep killed the thread before the
move-back ran, leaving non-required injected files (e.g.
exosuit_weapons.json) stranded in bin/ with no recovery path.
ensure_required_files_in_data() only knows about REQUIRED_BIN_FILENAMES,
so anything outside that list never came home.

Block closeEvent on injection_thread for up to 50s so the existing
move-back logic completes naturally. Distributors should still warn
users not to close mid-injection — this is a safety net, not a graceful
cancel.

Also drops the redundant unconditional self.rpc_manager.stop() that ran
after the hasattr-guarded block.
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