Skip to content

Fix for issues in ListView#1

Open
bleze wants to merge 1 commit into
masterfrom
ListViewCrash
Open

Fix for issues in ListView#1
bleze wants to merge 1 commit into
masterfrom
ListViewCrash

Conversation

@bleze

@bleze bleze commented May 23, 2026

Copy link
Copy Markdown
Owner

Root cause: Double-clicking an item calls doubleClicked(item) → onEdit() → navigateTo() → currentPage.reset(), which destroys the Page and the ListView itself. Back in onItemClick, this is dangling — any access (e.g. this->activated) crashes with "memory access out of bounds".

Three changes in ListView.cpp:

~ListView() — clears selectionChanged before root.reset(). Without this, when pin finally releases the ListView after onItemClick finishes, item removal calls selectItem(nullptr) → selectionChanged() → updateButtons() on the already-destroyed ListPage.

onItemClick — auto pin = shared_from_this() keeps the ListView alive for the duration of the handler, so this->activated (and anything else after doubleClicked returns) is safe to access.

onBodyKeyDown — same guard for the Enter-key path that calls activated(item), which has the identical lifetime hazard.

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.

1 participant