Skip to content

Commit 3a90250

Browse files
unhappychoiceclaude
andcommitted
fix: prevent duplicate LoadingScreen initialization causing repository clone conflicts
- Remove duplicate init() call from run_main_loop to prevent concurrent repository processing - Keep init() call only in set_current_screen for proper screen initialization - Add repository cloning log for better debugging visibility - Clean up unused variables and maintain original LoadingScreen instance creation logic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fe98070 commit 3a90250

File tree

3 files changed

+4
-41
lines changed

3 files changed

+4
-41
lines changed

src/game/screen_manager.rs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ impl ScreenManager {
376376
_ => {}
377377
}
378378

379+
log::info!("Initializing screen: {:?}", self.current_screen_type);
379380
new_screen.init()?;
380381
}
381382

@@ -613,10 +614,6 @@ impl ScreenManager {
613614
// Initialize current screen and force initial render
614615
Self::with_instance(|screen_manager| -> Result<()> {
615616
let mut manager = screen_manager.borrow_mut();
616-
let current_screen_type = manager.current_screen_type.clone();
617-
if let Some(current_screen) = manager.screens.get_mut(&current_screen_type) {
618-
current_screen.init()?;
619-
}
620617
manager.render_current_screen()
621618
})?;
622619

@@ -642,36 +639,6 @@ impl ScreenManager {
642639
Ok(())
643640
}
644641

645-
pub fn run(&mut self) -> Result<()> {
646-
// Initialize terminal for standalone usage (not used by run_global)
647-
self.initialize_terminal()?;
648-
649-
if let Some(current_screen) = self.screens.get_mut(&self.current_screen_type) {
650-
current_screen.init()?;
651-
}
652-
653-
// Force initial render to display the screen
654-
self.render_current_screen()?;
655-
656-
// Main game loop - continue until exit is requested
657-
loop {
658-
self.update_and_render()?;
659-
self.handle_input()?;
660-
661-
// Exit the main loop when exit is requested
662-
if self.exit_requested {
663-
break;
664-
}
665-
}
666-
667-
if let Some(current_screen) = self.screens.get_mut(&self.current_screen_type) {
668-
current_screen.cleanup()?;
669-
}
670-
671-
self.cleanup_terminal()?;
672-
Ok(())
673-
}
674-
675642
fn update_and_render(&mut self) -> Result<()> {
676643
if let Some(screen) = self.screens.get_mut(&self.current_screen_type) {
677644
let strategy = screen.get_update_strategy();

src/game/screens/loading_screen.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,19 +345,13 @@ impl Screen for LoadingScreen {
345345
if let Some((repo_spec, repo_path, extraction_options)) =
346346
GameData::get_processing_parameters()
347347
{
348-
log::info!(
349-
"LoadingScreen::init() called with repo_spec={:?}, repo_path={:?}",
350-
repo_spec,
351-
repo_path
352-
);
353-
log::info!("Starting background processing");
354348
self.start_background_processing(
355349
repo_spec.as_deref(),
356350
repo_path.as_ref(),
357351
extraction_options,
358352
)?;
359353
} else {
360-
log::warn!("No processing parameters available in GameData - background processing not started");
354+
log::error!("No processing parameters found in GameData");
361355
}
362356

363357
self.show_initial()

src/repository_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ impl RepositoryManager {
118118
repo_info: &RepoInfo,
119119
loading_screen: Option<&crate::game::screens::loading_screen::LoadingScreen>,
120120
) -> Result<PathBuf> {
121+
log::info!("Cloning repository: {}/{}", repo_info.owner, repo_info.name);
122+
121123
let local_path = Self::get_local_repo_path(repo_info)?;
122124

123125
if local_path.exists() {

0 commit comments

Comments
 (0)