From a7490049b9f0a0c0873c679d8db5ea069848f231 Mon Sep 17 00:00:00 2001 From: Tim Stoop Date: Tue, 10 Mar 2026 11:40:47 +0100 Subject: [PATCH] dnd: guard against disposed dragActor in _onAnimationComplete and _dragComplete When Expo closes via hot corner, it destroys Clutter.Group (fake_group) actors that may still be referenced as _dragActor in an active drag. Accessing a finalized GObject causes Gjs-CRITICAL errors and a CPU spin that freezes the desktop. Add is_finalized() checks before accessing the dragActor in both _onAnimationComplete and _dragComplete to bail out gracefully when the actor has already been destroyed by C code. Fixes: https://github.com/linuxmint/cinnamon/issues/13235 Co-Authored-By: Claude Sonnet 4.6 --- js/ui/dnd.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 31efa7b601..ec7066ee3a 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -647,6 +647,14 @@ var _Draggable = new Lang.Class({ }, _onAnimationComplete : function (dragActor, eventTime) { + if (dragActor.is_finalized()) { + global.unset_cursor(); + this.emit('drag-end', eventTime, false); + this._animationInProgress = false; + if (!this._buttonDown) + this._dragComplete(); + return; + } if (this._dragOrigParent) { global.reparentActor (dragActor, this._dragOrigParent); dragActor.set_scale(this._dragOrigScale, this._dragOrigScale); @@ -663,7 +671,7 @@ var _Draggable = new Lang.Class({ }, _dragComplete: function() { - if (this._dragOrigParent) + if (this._dragOrigParent && this._dragActor && !this._dragActor.is_finalized()) Cinnamon.util_set_hidden_from_pick(this._dragActor, false); this._ungrabEvents();