[libadwaita/libadwaita-1-1] swipe-tracker: fix memory leak
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/libadwaita-1-1] swipe-tracker: fix memory leak
- Date: Fri, 13 May 2022 12:34:33 +0000 (UTC)
commit 3e8dda92173c5b7047a6ff5c207f03263eae3a68
Author: George Barrett <bob bob131 so>
Date: Fri May 13 08:27:04 2022 +1000
swipe-tracker: fix memory leak
AdwSwipeTracker allocates a GArray to hold event history but never
frees it. This commit adds a finalize implementation that ensures the
array gets freed.
Fixes 689b873411a6b5e3ed7dc67569feee62e479c5de.
(cherry picked from commit 61a0488b10026af8067f970dcbfdf8bdeee71c56)
src/adw-swipe-tracker.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/src/adw-swipe-tracker.c b/src/adw-swipe-tracker.c
index 261bc8d4..e4ddce8b 100644
--- a/src/adw-swipe-tracker.c
+++ b/src/adw-swipe-tracker.c
@@ -914,6 +914,16 @@ adw_swipe_tracker_dispose (GObject *object)
G_OBJECT_CLASS (adw_swipe_tracker_parent_class)->dispose (object);
}
+static void
+adw_swipe_tracker_finalize (GObject *object)
+{
+ AdwSwipeTracker *self = ADW_SWIPE_TRACKER (object);
+
+ g_array_free (self->event_history, TRUE);
+
+ G_OBJECT_CLASS (adw_swipe_tracker_parent_class)->finalize (object);
+}
+
static void
adw_swipe_tracker_get_property (GObject *object,
guint prop_id,
@@ -997,6 +1007,7 @@ adw_swipe_tracker_class_init (AdwSwipeTrackerClass *klass)
object_class->constructed = adw_swipe_tracker_constructed;
object_class->dispose = adw_swipe_tracker_dispose;
+ object_class->finalize = adw_swipe_tracker_finalize;
object_class->get_property = adw_swipe_tracker_get_property;
object_class->set_property = adw_swipe_tracker_set_property;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]