Skip to content

FIX: Safer close#127

Merged
GuillaumeFavelier merged 1 commit intopyvista:mainfrom
larsoner:close
Oct 5, 2021
Merged

FIX: Safer close#127
GuillaumeFavelier merged 1 commit intopyvista:mainfrom
larsoner:close

Conversation

@larsoner
Copy link
Contributor

@larsoner larsoner commented Oct 5, 2021

Qt callbacks should never raise an error or you get a segfault:

https://github.com/mne-tools/mne-python/pull/9803/checks?check_run_id=3796599057

E   subprocess.CalledProcessError: Command '['/opt/hostedtoolcache/Python/3.9.7/x64/bin/python', '-uc', "import mne; mne.viz.create_3d_figure((800, 600)); backend = mne.viz.get_3d_backend(); assert backend == 'pyvistaqt', backend"]' died with <Signals.SIGABRT: 6>.
...
Traceback (most recent call last):

  File "/opt/hostedtoolcache/Python/3.9.7/x64/lib/python3.9/site-packages/pyvistaqt/plotting.py", line 602, in close

    self.app_window.close()

RuntimeError: wrapped C/C++ object of type MainWindow has been deleted

This PR just more safely wraps the handler in a try/except to avoid this.

Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

GitHub actions appears to be degraded at the moment...

@larsoner
Copy link
Contributor Author

larsoner commented Oct 5, 2021

@akaszynski thanks for the quick review. @GuillaumeFavelier can you look and merge if you're happy?

Copy link
Contributor

@GuillaumeFavelier GuillaumeFavelier left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the addition @larsoner

@GuillaumeFavelier GuillaumeFavelier merged commit 3ab8537 into pyvista:main Oct 5, 2021
@larsoner larsoner mentioned this pull request Dec 7, 2021
@larsoner larsoner deleted the close branch December 7, 2021 19:10
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