Skip to content

[fix] Hdf5TreeModel 'destroyed' signal can segfault for python>=3.13#4616

Open
woutdenolf wants to merge 4 commits into
mainfrom
4605-qt-bug-qwidgetdestroyed-callback-referencing-the-qwidget-itself-can-cause-segfaults
Open

[fix] Hdf5TreeModel 'destroyed' signal can segfault for python>=3.13#4616
woutdenolf wants to merge 4 commits into
mainfrom
4605-qt-bug-qwidgetdestroyed-callback-referencing-the-qwidget-itself-can-cause-segfaults

Conversation

@woutdenolf

@woutdenolf woutdenolf commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

PR summary

Fix segfault on gc.collect() in the following situation, a Qt/Python object destruction and garbage collection scenario, on python 3.13 or 3.14

pip install --pre "ewoksfluo[test] @ git+https://gitlab.esrf.fr/workflow/ewoksapps/ewoksfluo.git@971b8c67a6447920ac9ce8be1d6aab17e24acd8a"
pytest -v -ra -W error -W ignore::DeprecationWarning:orangecanvas.utils.localization -W ignore::DeprecationWarning:orangecanvas.utils.localization.si -W ignore::DeprecationWarning:matplotlib._fontconfig_pattern -W ignore::DeprecationWarning:matplotlib._mathtext -W ignore::pydantic.warnings.PydanticDeprecatedSince20 -W "ignore:Field name \"pk\" in \"EmbeddedJsonModel\" shadows an attribute in parent \"JsonModel\":UserWarning" --pyargs ewoksfluo -k test_mesh_tasks_widget

AI Disclosure

  • No AI used
  • AI tool(s) ... used for ...

@woutdenolf woutdenolf requested a review from t20100 June 15, 2026 13:12
@woutdenolf woutdenolf force-pushed the 4605-qt-bug-qwidgetdestroyed-callback-referencing-the-qwidget-itself-can-cause-segfaults branch from 6442b81 to 0938617 Compare June 15, 2026 14:54
@woutdenolf woutdenolf marked this pull request as draft June 15, 2026 14:54
@woutdenolf woutdenolf removed the request for review from t20100 June 15, 2026 14:54
@woutdenolf woutdenolf force-pushed the 4605-qt-bug-qwidgetdestroyed-callback-referencing-the-qwidget-itself-can-cause-segfaults branch from 0938617 to ba6df5e Compare June 15, 2026 15:17
@woutdenolf woutdenolf marked this pull request as ready for review June 15, 2026 15:17
@woutdenolf woutdenolf requested a review from t20100 June 15, 2026 15:17

@t20100 t20100 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the investigations!!

@woutdenolf woutdenolf force-pushed the 4605-qt-bug-qwidgetdestroyed-callback-referencing-the-qwidget-itself-can-cause-segfaults branch from ba6df5e to ddeafa4 Compare June 15, 2026 20:02
Comment thread src/silx/_utils.py Outdated
self._args = args
self._kwargs = kwargs

def __call__(self, *_, **__):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was hesitating between

  • IgnoreArgPartial ignore all arguments: __call__(self, *_, **__)
  • NoArgPartial do not accept any arguments: __call__(self)

Perhaps the second is a better pattern?

@t20100 t20100 Jun 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 for NoArgPartial

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.

Qt bug: QWidget.destroyed callback referencing the QWidget itself can cause segfaults

2 participants