[gnome-shell/gbsneto/icon-grid-dnd-fixes: 14/14] appDisplay: Protect against source icon destruction
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd-fixes: 14/14] appDisplay: Protect against source icon destruction
- Date: Thu, 24 Sep 2020 23:28:11 +0000 (UTC)
commit a18150244dead39bb3db70d95d5f268dea1cdf2b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Sep 24 18:57:56 2020 -0300
appDisplay: Protect against source icon destruction
When dragging icons out of a folder dialog, there is a very peculiar
combination of steps that may break GNOME Shell:
1. Open an app folder dialog
2. Start dragging an icon to outside the grid
3. Wait until the popdown animation starts
4. Before it finishes, drop the icon
5. See the warnings / crash
That's caused by the source icon being destroyed after the delayed
move timer starts, and before it finishes.
Protect against the source icon being destroyed before the delayed
move timeout triggers by connecting to the 'destroy' signal and
removing the timeout on the callback.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
js/ui/appDisplay.js | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index a1558ff39f..99f209fa32 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -359,11 +359,17 @@ var BaseAppView = GObject.registerClass({
this._removeDelayedMove();
this._targetDropPosition = { page, position };
+ const id = source.connect('destroy', () => {
+ source.disconnect(id);
+ this._removeDelayedMove();
+ });
+
this._delayedMoveId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
DELAYED_MOVE_TIMEOUT, () => {
this._moveItem(source, page, position);
this._targetDropPosition = null;
this._delayedMoveId = 0;
+ source.disconnect(id);
return GLib.SOURCE_REMOVE;
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]