Commit 95e353fd authored by Marco Trevisan's avatar Marco Trevisan 🎺 Committed by Marco Trevisan

boxpointer: Unset the sourceActor on destruction

A boxpointer sourceActor could be destroyed before the boxpointer itself.
In such case, unset the sourceActor reference, connecting to 'destroy' signal.

Fixes: #1295
!576


(cherry picked from commit 2fd12016)
parent 24cb1c1a
Pipeline #88944 passed with stages
in 4 minutes and 8 seconds
......@@ -50,6 +50,15 @@ var BoxPointer = GObject.registerClass({
this._sourceAlignment = 0.5;
this._capturedEventId = 0;
this._muteInput();
this.connect('destroy', this._onDestroy.bind(this));
}
_onDestroy() {
if (this._sourceActorDestroyId) {
this._sourceActor.disconnect(this._sourceActorDestroyId);
delete this._sourceActorDestroyId;
}
}
get arrowSide() {
......@@ -454,9 +463,26 @@ var BoxPointer = GObject.registerClass({
// so that we can query the correct size.
this.show();
this._sourceActor = sourceActor;
if (!this._sourceActor || sourceActor != this._sourceActor) {
if (this._sourceActorDestroyId) {
this._sourceActor.disconnect(this._sourceActorDestroyId);
delete this._sourceActorDestroyId;
}
this._sourceActor = sourceActor;
if (this._sourceActor) {
this._sourceActorDestroyId = this._sourceActor.connect('destroy', () => {
this._sourceActor = null;
delete this._sourceActorDestroyId;
})
}
}
this._arrowAlignment = alignment;
if (!this._sourceActor)
return;
this._reposition();
this._updateFlip();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment