Skip to content

No update in spdAux::TryRefreshTree and Kratos::EndCreatePreprocessTBar - #1051

Open
escolano wants to merge 1 commit into
KratosMultiphysics:masterfrom
escolano:fix/no-update-in-refresh-timer
Open

escolano wants to merge 1 commit into
KratosMultiphysics:masterfrom
escolano:fix/no-update-in-refresh-timer

Conversation

@escolano

@escolano escolano commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Two procs called a full update:

  • spdAux::TryRefreshTree (scripts/spdAuxiliar.tcl) calls update and update idletasks, and reschedules itself every 750 ms with after 750 while a model is open. A timer callback also runs inside any other code that enters the event loop, so this update processed user events (clicks on the menubar, other timers) in the middle of that code. The proc already runs from a timer, so the pending events have been processed before it starts.
  • Kratos::EndCreatePreprocessTBar (scripts/Menus.tcl) ended with update. It runs from Kratos::Event_EndGIDPostProcess, while GiD goes from postprocess to preprocess and rebuilds its menus. ReleaseToolbar, destroy and unset do not need it.

How we found it: GiD crashed when the menubar was clicked while going back from postprocess to preprocess with a Fluid 2D model (the cylinder-in-flow example, after animating the pressure). The click was processed inside these nested update calls. The crash itself was a Tk bug, reported as tk/a680524fb0, and GiD now also defers its menu rebuild, but these update calls are what let user events in during the switch.

The design of the tree refresh is unchanged: the refreshTreeTurn flag is set by spdAux::RequestRefresh and checked every 750 ms.

Tested with GiD 18.3 (developer version) on Windows, on the cylinder-in-flow example, going to postprocess, animating and back to preprocess:

  • These procs no longer call update during the switch.
  • After spdAux::RequestRefresh the tree is refreshed in the next 750 ms period (refreshTreeTurn back to 0).
  • No errors. Eight simulated clicks on the menubar during the switch were handled normally.

🤖 Generated with Claude Code

TryRefreshTree runs from a 750 ms timer, which also fires inside any other
code that enters the event loop; its update and update idletasks then
processed user events (e.g. clicks on the menubar) in the middle of that code.
EndCreatePreprocessTBar ended with an update while GiD goes from postprocess
to preprocess (EndGIDPostProcess event). Neither needs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants