about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-07-04 18:10:19 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-07-04 18:10:19 +0300
commit493ae133d87fff8269376cded4a2e0cdae30b607 (patch)
treeaf5580d1d28c9fb3e4677a277f9f18bad8abb0f0
parent2eef58495697dddb9c9a4f9bdce795dc7a55bb7e (diff)
downloadfungus-launcher-493ae133d87fff8269376cded4a2e0cdae30b607.tar.gz
fungus-launcher-493ae133d87fff8269376cded4a2e0cdae30b607.tar.xz
fix repeated attempts to hide splash screen
-rw-r--r--fungus/game_launcher.py4
-rw-r--r--fungus/splash_window.py9
2 files changed, 11 insertions, 2 deletions
diff --git a/fungus/game_launcher.py b/fungus/game_launcher.py
index d8460cb..17c0e7d 100644
--- a/fungus/game_launcher.py
+++ b/fungus/game_launcher.py
@@ -555,6 +555,8 @@ class GameLauncher:
         if not clean_line:
             return
 
+        log.debug("_on_io_line: [%s] %s", "err" if is_stderr else "out", clean_line)
+
         # Accumulate stderr for error reporting
         if is_stderr:
             self.error_output.append(clean_line)
@@ -563,7 +565,7 @@ class GameLauncher:
         if self._on_output_line:
             self._on_output_line(clean_line)
 
-        # Check for game-running signals — signal the adapter to close
+        # Check for game-running signals — signal the adapter to close.
         if self._detect_game_running(clean_line):
             if self._on_splash_close:
                 log.debug("invoking splash-close callback")
diff --git a/fungus/splash_window.py b/fungus/splash_window.py
index 7edbbc6..f18918c 100644
--- a/fungus/splash_window.py
+++ b/fungus/splash_window.py
@@ -142,10 +142,17 @@ class SplashWindow:
             self._close_button.set_sensitive(True)
 
     def close(self) -> None:
-        """Destroy the splash window and invoke the close callback."""
+        """Destroy the splash window and invoke the close callback.
+
+        The callback is cleared after the first invocation to prevent
+        an infinite loop: ``close()`` → ``_on_close()`` → ``idle_add(close)``
+        → ``close()`` → …
+        """
         if self._window is not None:
             self._window.destroy()  # type: ignore[union-attr]
+        # Clear the callback so repeated close() calls are no-ops.
         self._on_close()
+        self._on_close = lambda: None
 
     def show(self) -> None:
         """Show the splash window (no-op if already visible)."""