@@ -19,13 +19,6 @@ export interface DashBounds {
1919const TARGET_BOX_PADDING = 8 ;
2020
2121type TargetBoxListener = ( bounds : DashBounds | null ) => void ;
22- type TimeoutProp =
23- | '_autohideTimeoutId'
24- | '_delayEnsureAutoHideId'
25- | '_blockAutoHideDelayId'
26- | '_workAreaUpdateId'
27- | '_iconResizeTimeoutId'
28- | '_springLoadTimerId' ;
2922
3023const AUTOHIDE_TIMEOUT = 100 ;
3124const SPRING_LOAD_DELAY = 400 ;
@@ -139,7 +132,30 @@ export class AuroraDash extends Dash {
139132
140133 override destroy ( ) : void {
141134 this . _isDestroyed = true ;
142- this . _clearAllTimeouts ( ) ;
135+ if ( this . _autohideTimeoutId !== 0 ) {
136+ GLib . source_remove ( this . _autohideTimeoutId ) ;
137+ this . _autohideTimeoutId = 0 ;
138+ }
139+ if ( this . _delayEnsureAutoHideId !== 0 ) {
140+ GLib . source_remove ( this . _delayEnsureAutoHideId ) ;
141+ this . _delayEnsureAutoHideId = 0 ;
142+ }
143+ if ( this . _blockAutoHideDelayId !== 0 ) {
144+ GLib . source_remove ( this . _blockAutoHideDelayId ) ;
145+ this . _blockAutoHideDelayId = 0 ;
146+ }
147+ if ( this . _workAreaUpdateId !== 0 ) {
148+ GLib . source_remove ( this . _workAreaUpdateId ) ;
149+ this . _workAreaUpdateId = 0 ;
150+ }
151+ if ( this . _iconResizeTimeoutId !== 0 ) {
152+ GLib . source_remove ( this . _iconResizeTimeoutId ) ;
153+ this . _iconResizeTimeoutId = 0 ;
154+ }
155+ if ( this . _springLoadTimerId !== 0 ) {
156+ GLib . source_remove ( this . _springLoadTimerId ) ;
157+ this . _springLoadTimerId = 0 ;
158+ }
143159
144160 // Remove the global DND drag monitor so its captured `this` doesn't
145161 // keep firing against a disposed AuroraDash if the dash is destroyed
@@ -291,7 +307,10 @@ export class AuroraDash extends Dash {
291307
292308 /** Schedule a delayed hover re-evaluation after visibility changes. */
293309 ensureAutoHide ( ) : void {
294- this . _clearTimeout ( '_delayEnsureAutoHideId' ) ;
310+ if ( this . _delayEnsureAutoHideId !== 0 ) {
311+ GLib . source_remove ( this . _delayEnsureAutoHideId ) ;
312+ this . _delayEnsureAutoHideId = 0 ;
313+ }
295314 this . _delayEnsureAutoHideId = GLib . timeout_add (
296315 GLib . PRIORITY_DEFAULT ,
297316 VISIBILITY_ANIMATION_TIME ,
@@ -594,7 +613,10 @@ export class AuroraDash extends Dash {
594613 this . _overrideIconActivation ( ) ;
595614
596615 if ( dashAny . iconSize !== oldIconSize ) {
597- this . _clearTimeout ( '_iconResizeTimeoutId' ) ;
616+ if ( this . _iconResizeTimeoutId !== 0 ) {
617+ GLib . source_remove ( this . _iconResizeTimeoutId ) ;
618+ this . _iconResizeTimeoutId = 0 ;
619+ }
598620 this . _iconResizeTimeoutId = GLib . timeout_add ( GLib . PRIORITY_DEFAULT , ANIMATION_TIME , ( ) => {
599621 this . _iconResizeTimeoutId = 0 ;
600622 if ( this . _workArea ) this . applyWorkArea ( this . _workArea ) ;
@@ -817,14 +839,20 @@ export class AuroraDash extends Dash {
817839
818840 private _clearSpringLoad ( ) : void {
819841 this . _springLoadTarget ?. remove_style_class_name ?.( 'aurora-drag-hover' ) ;
820- this . _clearTimeout ( '_springLoadTimerId' ) ;
842+ if ( this . _springLoadTimerId !== 0 ) {
843+ GLib . source_remove ( this . _springLoadTimerId ) ;
844+ this . _springLoadTimerId = 0 ;
845+ }
821846 this . _springLoadTarget = null ;
822847 }
823848
824849 /** Start or restart the autohide timeout — hides the dock if not hovered/blocked. */
825850 private _onHover ( ) : void {
826851 if ( this . _isDestroyed ) return ;
827- this . _clearTimeout ( '_autohideTimeoutId' ) ;
852+ if ( this . _autohideTimeoutId !== 0 ) {
853+ GLib . source_remove ( this . _autohideTimeoutId ) ;
854+ this . _autohideTimeoutId = 0 ;
855+ }
828856 this . _autohideTimeoutId = GLib . timeout_add ( GLib . PRIORITY_DEFAULT , AUTOHIDE_TIMEOUT , ( ) => {
829857 if ( this . _isDestroyed ) {
830858 this . _autohideTimeoutId = 0 ;
@@ -845,7 +873,10 @@ export class AuroraDash extends Dash {
845873 /** If the cursor is still over the dash container, ensure the dock stays shown. */
846874 private _ensureHoverState ( ) : void {
847875 if ( this . _isDestroyed ) return ;
848- this . _clearTimeout ( '_blockAutoHideDelayId' ) ;
876+ if ( this . _blockAutoHideDelayId !== 0 ) {
877+ GLib . source_remove ( this . _blockAutoHideDelayId ) ;
878+ this . _blockAutoHideDelayId = 0 ;
879+ }
849880 this . _blockAutoHideDelayId = GLib . idle_add ( GLib . PRIORITY_DEFAULT , ( ) => {
850881 if ( ! this . _isDestroyed ) {
851882 const dashContainer = ( this as any ) . _dashContainer as St . Widget | undefined ;
@@ -953,22 +984,6 @@ export class AuroraDash extends Dash {
953984 } ) ;
954985 }
955986
956- private _clearTimeout ( prop : TimeoutProp ) : void {
957- if ( this [ prop ] ) {
958- GLib . source_remove ( this [ prop ] ) ;
959- this [ prop ] = 0 ;
960- }
961- }
962-
963- private _clearAllTimeouts ( ) : void {
964- this . _clearTimeout ( '_autohideTimeoutId' ) ;
965- this . _clearTimeout ( '_delayEnsureAutoHideId' ) ;
966- this . _clearTimeout ( '_blockAutoHideDelayId' ) ;
967- this . _clearTimeout ( '_workAreaUpdateId' ) ;
968- this . _clearTimeout ( '_iconResizeTimeoutId' ) ;
969- this . _clearTimeout ( '_springLoadTimerId' ) ;
970- }
971-
972987 private static _boundsEqual ( a : DashBounds | null , b : DashBounds | null ) : boolean {
973988 if ( a === b ) return true ;
974989 if ( ! a || ! b ) return false ;
0 commit comments