From ada6dc1feb133421a6ec2d80177175c2e4872f82 Mon Sep 17 00:00:00 2001 From: Levi Neely <141506390+lneely@users.noreply.github.com> Date: Sat, 1 Aug 2026 17:08:22 +0200 Subject: [PATCH] fix context menu: kill target session, not active one Right-click now stores the target session ID in a root-level property (killTargetSessionId) before popping the menu, avoiding unreliable QML parent chain traversal that could resolve to the wrong delegate. --- gui/main.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gui/main.qml b/gui/main.qml index 76b6001..bf0f8b2 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -90,6 +90,9 @@ ApplicationWindow { onTriggered: chatView.positionViewAtEnd() } + // Session ID to kill — set on right-click, consumed by context menu + property string killTargetSessionId: "" + // Session tree model — flat list with level info ListModel { id: sessionTreeModel @@ -538,6 +541,9 @@ ApplicationWindow { onClicked: function(mouse) { if (mouse.button === Qt.RightButton) { if (type === "session") { + var item = sessionTreeModel.get(parent.modelIndex) + if (item) + root.killTargetSessionId = item.id sessionCtxMenu.popup() } return @@ -561,9 +567,8 @@ ApplicationWindow { text: "Kill" icon.color: "#f44336" onClicked: { - var item = sessionTreeModel.get(parent.parent.parent.modelIndex) - if (item && item.type === "session") - ollie.killSession(item.id) + if (root.killTargetSessionId) + ollie.killSession(root.killTargetSessionId) ollie.refreshSessions() } }