Skip to content

Do not perform diagram updates outside of a transaction #3205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 24, 2024
Merged

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Mar 24, 2024

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

Spontaneous errors could occur if a diagram was updated. This was because the update happened from within the idle handler of the diagram-view widget.

Some items on a diagram did updates that caused handle positions or the position (matrix) to change.

Issue Number: Fixes #3203. It may also be a fix for #3069.

What is the new behavior?

Updates do no longer happen from the view. Instead, the application should in time update the diagram state.

Does this PR introduce a breaking change?

  • Yes
  • No
  • Take care that updates happen in time, as they do no longer happen automagically.

Other information

  • Association ends are now updated by model changes, no longer in the update method
  • Also fixes the hypothesis test command. This was broken when we changed from Xvfb to Mutter.

@amolenaar amolenaar linked an issue Mar 24, 2024 that may be closed by this pull request
3 tasks
@github-actions github-actions bot added the python Pull requests that update Python code label Mar 24, 2024
@amolenaar amolenaar mentioned this pull request Mar 24, 2024
3 tasks
Not in the update function anymore.
`update_now()` is part if the protocol that Gaphas views use
to communicate with the model (`Diagram`).

By decoupling those we can move away from a model where diagram
updates are done asynchronously.
We need our updates to happen within the context of a transaction.

A possitive side effect may be that tearing, when moveing something in a
diagram, is a thing of the past.
This ensures that all updates happen within the
context of a transaction.
Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amolenaar, this is a nice fix!

@danyeaw danyeaw added fix A fix for a bug and removed python Pull requests that update Python code labels Mar 24, 2024
@danyeaw danyeaw merged commit bd1fafb into main Mar 24, 2024
@danyeaw danyeaw deleted the reduce-update branch March 24, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto layout crashes Error when doing "undo"
2 participants