[gnome-documents] preview: ensure signals/sources are removed upon destroy
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] preview: ensure signals/sources are removed upon destroy
- Date: Mon, 5 Aug 2019 14:03:46 +0000 (UTC)
commit 990871da0dc9a8a9e9aa53d714d39cb0b8d83141
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Aug 3 18:33:35 2019 +0200
preview: ensure signals/sources are removed upon destroy
Some of the objects (e.g. the overlay) will outlive the preview, so
we need to disconnect signals from them when the preview or one of
its subcomponents are destroyed.
Also, we were not properly cleaning up some sources upon destruction
of the nav bar controls.
src/preview.js | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/preview.js b/src/preview.js
index 8382f50d..d7c2456b 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -590,7 +590,7 @@ var PreviewNavControls = class PreviewNavControls {
this._prevRevealer.show_all();
this._nextRevealer.show_all();
- this._overlay.connect('motion-notify-event', this._onMotion.bind(this));
+ this._overlayMotionId = this._overlay.connect('motion-notify-event', this._onMotion.bind(this));
this._tapGesture = new Gtk.GestureMultiPress({ propagation_phase: Gtk.PropagationPhase.CAPTURE,
touch_only: true,
@@ -613,6 +613,14 @@ var PreviewNavControls = class PreviewNavControls {
return false;
}
+ _removeMotionTimeout() {
+ if (this._motionId == 0)
+ return;
+
+ Mainloop.source_remove(this._motionId);
+ this._motionId = 0;
+ }
+
_motionTimeout() {
this._motionId = 0;
this._visibleInternal = true;
@@ -706,6 +714,14 @@ var PreviewNavControls = class PreviewNavControls {
}
destroy() {
+ this._unqueueAutoHide();
+ this._removeMotionTimeout();
+
+ if (this._overlayMotionId != 0) {
+ this._overlay.disconnect(this._overlayMotionId);
+ this._overlayMotionId = 0;
+ }
+
if (this._barRevealer)
this._barRevealer.destroy();
this._prevRevealer.destroy();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]