fix(env): Environment Variables ✕ button never removed rows - #53
Merged
Conversation
) QML's model.removeRow(i) resolves to QAbstractItemModel's built-in C++ convenience, not the same-named Python slot, so the slot was unreachable and the call fell through to the default removeRows() stub that does nothing and returns false. Override the removeRows() virtual instead — the hook the C++ convenience actually delegates to. Adds a regression test that drives the call through a real QML engine (offscreen) so the broken dispatch path is the one under test. Bumps to 1.0.1 with changelog + metainfo release entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #52 — pressing the ✕ button in the Environment Variables editor did nothing, for every user.
Root cause: QML's
model.removeRow(i)resolves toQAbstractItemModel's built-in invokable C++removeRow(int, parent)convenience, not the same-named Python slot the model defined — the Python slot was unreachable from QML. The C++ convenience delegates to the virtualremoveRows(), which the model never overrode, so the call landed in the base-class stub that does nothing and returnsfalse. (The old comment claimedremoveRowwas the virtual — it isn't;removeRowsis.)Fix: drop the shadowed Python
removeRowslot and override theremoveRows(row, count, parent)virtual — the hook Qt actually dispatches to. The existing QML call site works unchanged, removal marks the editor dirty, and out-of-range/invalid-parent calls are rejected.Regression test:
tests/test_env_remove_row.pydrivesmodel.removeRow(i)through a real (offscreen) QML engine, so the exact dispatch path that broke is the one under test — a plain Python-side call would have passed even with the bug.Ships as v1.0.1: version bumped in
pyproject.toml/__init__.py, changelog entry, and Flatpak metainfo release entry added.Type
Checklist
ruff check protonshiftpassespytestpasses (44 passed, incl. 2 new regression tests)pyside6-qmllint— no QML changesCHANGELOG.mdupdated (as the[1.0.1]section)1.0.1release entry addedtest_core_safety.py— not touching shader_cache/scopebuddy regexesBreaking changes
None.
🤖 Generated with Claude Code