[gnome-shell] dnd: Handle destruction of drag actor during drag
- From: Maxim Ermilov <mermilov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] dnd: Handle destruction of drag actor during drag
- Date: Sun, 24 Oct 2010 01:49:23 +0000 (UTC)
commit 95ac478f87f90377bc59e9af0cf894becc126d37
Author: Maxim Ermilov <zaspire rambler ru>
Date: Sun Oct 24 05:45:54 2010 +0400
dnd: Handle destruction of drag actor during drag
The shell crashes if the drag actor is destroyed during the drag
operation. Cancel the drag gracefully in this case.
https://bugzilla.gnome.org/show_bug.cgi?id=620389
js/ui/dnd.js | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 217a839..9ebb2d4 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -86,6 +86,9 @@ _Draggable.prototype = {
Lang.bind(this, this._onButtonPress));
this.actor.connect('destroy', Lang.bind(this, function() {
+ this._actorDestroyed = true;
+ if (this._dragInProgress)
+ this._cancelDrag(global.get_current_time());
this.disconnectAll();
}));
this._onEventId = null;
@@ -417,6 +420,8 @@ _Draggable.prototype = {
targX,
targY,
event.get_time())) {
+ if (this._actorDestroyed)
+ return true;
// If it accepted the drop without taking the actor,
// handle it ourselves.
if (this._dragActor.get_parent() == this._dragActor.get_stage()) {
@@ -458,6 +463,12 @@ _Draggable.prototype = {
this._dragInProgress = false;
let [snapBackX, snapBackY] = this._getRestoreLocation();
+ if (this._actorDestroyed) {
+ global.unset_cursor();
+ this.emit('drag-end', eventTime, false);
+ return;
+ }
+
this._animationInProgress = true;
// No target, so snap back
Tweener.addTween(this._dragActor,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]