Skip to content

Engine's implementation of Simulation.goToStep not functioning correctly when called in FXUI #568

@Vuksaa

Description

@Vuksaa

The implementation of goToStep could be bugged. The way it is currently called by the FXUI produces some odd behaviours.
To observe the issue:

  1. Start a simulation with the -fxui flag.
  2. Play the simulation briefly, then pause it.
  3. Press the key corresponding to the "one step forward" action - this calls goToStep and passes it the current step + 1.
  4. The simulation does not move forward one step; instead, now the play/pause feature will move one step ahead, and occasionally crash the simulation.

I remember this specific sequence of actions was working as intended back when I implemented it in the FXUI, I'm not sure if it's an issue in how the FXUI calls goToStep or if the functionality of goToStep was changed. If it's the former, I can attempt to fix it through a PR, though I already tried tweaking it and couldn't get it right.

On a side note, the implementation in Engine.goToStep is different than what is documented in the javadoc for Simulation.goToStep:

  • in Engine, it attempts to pause the simulation when the current step is higher than the given argument.
  • in Simulation, it is described as if it executes a number of steps given as argument instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions