@@ -779,8 +779,13 @@ Item {
779779 delegate: Item {
780780 id: groupedTaskbarItem
781781
782- width: root .iconSize
783- height: root .iconSize
782+ // liveWindows is reassigned on scroll/focus; delegates can outlive rows and see null modelData
783+ readonly property var win: modelData
784+ readonly property bool winOk: win !== undefined && win !== null
785+
786+ width: winOk ? root .iconSize : 0
787+ height: winOk ? root .iconSize : 0
788+ visible: winOk
784789
785790 HoverHandler {
786791 id: windowHoverHandler
@@ -794,22 +799,25 @@ Item {
794799
795800 source: {
796801 root .iconRevision ; // Force re-evaluation when revision changes
797- return ThemeIcons .iconForAppId (modelData .appId ? .toLowerCase ());
802+ const w = groupedTaskbarItem .win ;
803+ if (! w || ! w .appId )
804+ return " " ;
805+ return ThemeIcons .iconForAppId (w .appId .toLowerCase ());
798806 }
799807 smooth: true
800808 asynchronous: true
801- opacity: modelData .isFocused ? Style .opacityFull : unfocusedIconsOpacity
802- layer .enabled : root .colorizeIcons && ! modelData .isFocused
809+ opacity: groupedTaskbarItem . winOk && groupedTaskbarItem . win .isFocused ? Style .opacityFull : unfocusedIconsOpacity
810+ layer .enabled : root .colorizeIcons && groupedTaskbarItem . winOk && ! groupedTaskbarItem . win .isFocused
803811
804812 Rectangle {
805813 id: groupedFocusIndicator
806- visible: modelData . isFocused || windowHoverHandler .hovered
814+ visible: ( groupedTaskbarItem . winOk && groupedTaskbarItem . win . isFocused ) || windowHoverHandler .hovered
807815 anchors .bottomMargin : - 2
808816 anchors .bottom : parent .bottom
809817 anchors .horizontalCenter : parent .horizontalCenter
810818 width: Style .toOdd (root .iconSize * 0.25 )
811819 height: 4
812- color: modelData . isFocused ? Color .mPrimary : Color .mHover
820+ color: ( groupedTaskbarItem . winOk && groupedTaskbarItem . win . isFocused ) ? Color .mPrimary : Color .mHover
813821 radius: Math .min (Style .radiusXXS , width / 2 )
814822 }
815823
@@ -828,22 +836,26 @@ Item {
828836 preventStealing: true
829837
830838 onPressed : mouse => {
831- if (mouse .button === Qt .LeftButton ) {
832- CompositorService .focusWindow (modelData );
839+ if (mouse .button === Qt .LeftButton && groupedTaskbarItem . winOk ) {
840+ CompositorService .focusWindow (groupedTaskbarItem . win );
833841 }
834842 }
835843
836844 onReleased : mouse => {
837- if (mouse .button === Qt .RightButton ) {
845+ if (mouse .button === Qt .RightButton && groupedTaskbarItem .winOk ) {
846+ const w = groupedTaskbarItem .win ;
838847 mouse .accepted = true ;
839848 TooltipService .hide ();
840- root .selectedWindowId = modelData .id || modelData .address || " " ;
841- root .selectedAppId = modelData .appId ;
849+ root .selectedWindowId = w .id || w .address || " " ;
850+ root .selectedAppId = w .appId ;
842851 openGroupedContextMenu (groupedTaskbarItem);
843852 }
844853 }
845854 onEntered: {
846- TooltipService .show (groupedTaskbarItem, modelData .title || modelData .appId || " Unknown app." , BarService .getTooltipDirection (root .screenName ));
855+ if (! groupedTaskbarItem .winOk )
856+ return ;
857+ const w = groupedTaskbarItem .win ;
858+ TooltipService .show (groupedTaskbarItem, w .title || w .appId || " Unknown app." , BarService .getTooltipDirection (root .screenName ));
847859 }
848860 onExited: {
849861 TooltipService .hide ();
0 commit comments