Skip to content
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

Fix non-responding widgets for multiple indexing runs #1257

Merged
merged 2 commits into from
Jul 20, 2022

Conversation

psavery
Copy link
Collaborator

@psavery psavery commented Jul 19, 2022

The previous design pattern created a list of QSignalBlocker objects,
and it relied on Python to perform reference counting and delete this list
at the end of the function, so that the widgets would become unblocked.

For some reason, if you run indexing multiple times, it appears that this
list is sometimes not deleted at the end of the function.

Instead of relying on Python to perform reference counting correctly,
let's use a context manager so that we can be sure the widgets get
unblocked.

This fixes an issue where widgets were not emitting signals in the eta
omega maps viewer when running the HEDM workflow multiple times.

We should also go back and fix any other cases of the design pattern, since
it appears to be error-prone.

The previous design pattern created a list of `QSignalBlocker` objects,
and it relied on Python to perform reference counting and delete this list
at the end of the function, so that the widgets would become unblocked.

For some reason, if you run indexing multiple times, it appears that this
list is sometimes not deleted at the end of the function.

Instead of relying on Python to perform reference counting correctly,
let's use a context manager so that we can be sure the widgets get
unblocked.

This fixes an issue where widgets were not emitting signals in the eta
omega maps viewer when running the HEDM workflow multiple times.

We should also go back and fix any other cases of the design pattern, since
it appears to be error-prone.

Signed-off-by: Patrick Avery <[email protected]>
@psavery psavery requested a review from cjh1 July 19, 2022 20:05
It appears that we can't always rely on python's reference counting
system to delete `QSignalBlocker` (or lists of `QSignalBlocker`) at
the end of method calls. As such, we should convert over to using the
`block_signals()` context manager from `hexrd.ui.utils`.

This commit moves all code over to that.

Signed-off-by: Patrick Avery <[email protected]>
Copy link
Collaborator

@cjh1 cjh1 left a comment

Choose a reason for hiding this comment

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

LGTM

@joelvbernier joelvbernier merged commit a3e45bc into HEXRD:master Jul 20, 2022
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.

3 participants