Skip to content

Commit bb3ebc1

Browse files
committed
Better guards for performance
1 parent d8e9cd4 commit bb3ebc1

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

src/appIcons.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ export const TaskbarAppIcon = GObject.registerClass(
447447
}
448448

449449
_onDestroy() {
450+
this._disposed = true
450451
super._onDestroy()
451452

452453
if (this._updateIconIdleId) {
@@ -1713,6 +1714,8 @@ export const TaskbarAppIcon = GObject.registerClass(
17131714
}
17141715

17151716
cancelXdndDragTimeout() {
1717+
if (this._disposed) return
1718+
17161719
this._timeoutsHandler.remove(T7)
17171720
this._xdndActionFired = false
17181721
this._inXdndDrag = false
@@ -1728,21 +1731,21 @@ export const TaskbarAppIcon = GObject.registerClass(
17281731
return DND.DragMotionResult.CONTINUE
17291732
}
17301733

1731-
// Cancel any pending panel-level xdnd timeout since the cursor is now
1732-
// over this icon
1733-
this.dtpPanel.cancelXdndOverviewTimeout()
1734-
1735-
// Clear state on all other icons (hover highlight, timers, fired flags).
1736-
// The xdnd walk stops at the first MOVE_DROP result so the panel's
1737-
// cancelXdndDragTimeouts() is never reached when moving between icons.
1738-
// Pass `this` so our own fired flag and timer are not disturbed.
1739-
this.dtpPanel.taskbar.cancelXdndDragTimeouts(this)
1740-
17411734
// Simulate hover highlight as if the cursor were normally over the icon
17421735
// (XDnD grabs the pointer so Clutter never sets hover automatically).
17431736
// Set _inXdndDrag before set_hover so that _onAppIconHoverChanged
17441737
// doesn't call requestOpen — preview opening is managed by T7 below.
17451738
if (!this.hover) {
1739+
// Cancel any pending panel-level xdnd timeout since the cursor is now
1740+
// over this icon
1741+
this.dtpPanel.cancelXdndOverviewTimeout()
1742+
1743+
// Clear state on all other icons (hover highlight, timers, fired flags).
1744+
// The xdnd walk stops at the first MOVE_DROP result so the panel's
1745+
// cancelXdndDragTimeouts() is never reached when moving between icons.
1746+
// Pass `this` so our own fired flag and timer are not disturbed.
1747+
this.dtpPanel.taskbar.cancelXdndDragTimeouts(this)
1748+
17461749
this._inXdndDrag = true
17471750
this.set_hover(true)
17481751
}

src/taskbar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,9 @@ export const Taskbar = class extends EventEmitter {
710710

711711
cancelXdndDragTimeouts(exceptIcon) {
712712
this._getAppIcons().forEach((icon) => {
713-
if (icon !== exceptIcon) icon.cancelXdndDragTimeout()
713+
if (icon && icon !== exceptIcon && !icon._disposed) {
714+
icon.cancelXdndDragTimeout()
715+
}
714716
})
715717
}
716718

0 commit comments

Comments
 (0)