Skip to content

dnd: guard against disposed dragActor in _onAnimationComplete and _dragComplete#13633

Open
timstoop wants to merge 1 commit intolinuxmint:masterfrom
timstoop:fix/dnd-fake-group-disposed
Open

dnd: guard against disposed dragActor in _onAnimationComplete and _dragComplete#13633
timstoop wants to merge 1 commit intolinuxmint:masterfrom
timstoop:fix/dnd-fake-group-disposed

Conversation

@timstoop
Copy link
Copy Markdown

Summary

Fixes #13235

When Expo closes via hot corner, it creates and destroys Clutter.Group (overridden as fake_group in overrides.js) actors during the close animation. If a drag is in progress at that moment, dnd.js still holds a reference to the now-disposed actor in this._dragActor. When the drag ends, _onAnimationComplete and _dragComplete attempt to access the finalized GObject, triggering Gjs-CRITICAL errors and a CPU spin that freezes the desktop.

  • Add is_finalized() check in _onAnimationComplete to bail out gracefully when the drag actor has been destroyed by C code before the animation completed
  • Add is_finalized() guard in _dragComplete before calling util_set_hidden_from_pick on the drag actor

Tested on Linux Mint 22.3 / Cinnamon 6.6.7 with dual monitors and NVIDIA RTX 3050. No new fake_group disposed errors in ~/.xsession-errors after fix, where previously they appeared consistently when using hot corners to trigger Expo.

Note: this fix was developed with AI assistance (Claude).

…agComplete

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: linuxmint#13235

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mtwebster
Copy link
Copy Markdown
Member

I can't reproduce this, and using is_finalized() is a hack we should be moving away from using, not using more.

Can you apply this commit and try to reproduce the original issue (without your fix here).

@timstoop
Copy link
Copy Markdown
Author

timstoop commented Apr 5, 2026

Hi @mtwebster, apologies for the slow reply.

Quick note before the test results: the base my branch is built on is d75d528 (tag master.mint22), which is what ships as cinnamon-common 6.6.7+zena on Linux Mint 22. That commit already contains 3c7cd1a (the grab-cleanup block at js/ui/dnd.js lines 142-146), so the tree I tested against effectively is "3c7cd1a9f applied, my patch reverted".

To reproduce, I replaced the installed /usr/share/cinnamon/js/ui/dnd.js with the unpatched version from d75d528, restarted Cinnamon, then: dragged a window, triggered Expo via the hot corner mid-drag, moved the window to another workspace, released.

The Gjs-CRITICAL still appears:

Gjs-CRITICAL **: Object .Gjs_ui_overrides_fake_group (0x...), has been already disposed - impossible to access it.
== Stack trace ==
#0  /usr/share/cinnamon/js/ui/dnd.js:667
#2  /usr/share/cinnamon/js/ui/dnd.js:546
#4  /usr/share/cinnamon/js/ui/dnd.js:205
#6  /usr/share/cinnamon/js/ui/dnd.js:57

Frame #0 is Cinnamon.util_set_hidden_from_pick(this._dragActor, false) in _dragComplete, frame #2 is the _dragComplete(event) call from _dragActorDropped. With my patch back in place on the same tree and the same user action, no errors are logged.

That said, I hear you on is_finalized() being something the project is moving away from, and the fact that you cannot reproduce it is worth taking seriously. It is entirely possible something specific to my setup is contributing: Linux Mint 22.3, dual monitors, NVIDIA RTX 3050 with the 590 open driver, grouped-window-list instead of window-list. If you have a suggestion for a cleaner angle, for example preventing the drag actor from being disposed mid-drag on the C side, or holding a ref for the drag's duration, I am happy to try that approach instead and close this PR in favour of it.

Happy to share more logs, a dconf dump, or try any diagnostic patch you would like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cinnamon freezes with Gjs-CRITICAL "dnd.js fake_group disposed" errors when using hot corners to trigger Expo/Workspace switcher

2 participants