Skip to content

fix engine card refresh, remove-by-id and shutdown guards#110

Open
nghiphaam wants to merge 2 commits into
Psyyke:mainfrom
nghiphaam:fix/appserver-engine-cards
Open

fix engine card refresh, remove-by-id and shutdown guards#110
nghiphaam wants to merge 2 commits into
Psyyke:mainfrom
nghiphaam:fix/appserver-engine-cards

Conversation

@nghiphaam
Copy link
Copy Markdown
Contributor

appServer (Electron + engine server) fixes:

  • ui/index.js refreshEngineCards: engine ids are sha256 hex strings, but cards were compared via Number(...) which is always NaN, so active was removed from every card regardless of which engines were alive. Now compares as strings. Also dropped a leftover console.log.
  • Engine removal used a positional index captured in the card's click handler, but renderEngineGrid only appends new cards, so after a removal (which splices the array) surviving cards kept stale indices and could remove the wrong engine. removeEngine now takes an engineId and looks up the current index itself (engine.js, main.js, preload.js, ui/index.js).
  • engine.js: the close handler (engine self-terminating) removed the alive engine object but never called refreshEngineCards, so the card stayed "active"; it now refreshes. Removed a duplicate removeConsoleView call in killSpecificEngine.
  • engine.js / util.js: the renderer-send helpers (renderEngineGrid, addConsoleView, removeConsoleView, refreshEngineCards, log, toast) dereferenced mainWindow.webContents with no guard and could throw during shutdown when engines close. They now go through a guarded helper that checks mainWindow.isDestroyed().

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