summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/glibext/gwidthtracker.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ee1fa84..336a34b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
16-10-21 Cyrille Bagard <nocbos@gmail.com>
+ * src/glibext/gwidthtracker.c:
+ Compute again portion addresses after reallocations as their base address
+ may have changed. Do not use uninitialized value as cache status.
+
+16-10-21 Cyrille Bagard <nocbos@gmail.com>
+
* src/common/shuffle.c:
Avoid to copy overlapping memory areas.
diff --git a/src/glibext/gwidthtracker.c b/src/glibext/gwidthtracker.c
index 10d01ab..94e7f36 100644
--- a/src/glibext/gwidthtracker.c
+++ b/src/glibext/gwidthtracker.c
@@ -518,6 +518,8 @@ void g_width_tracker_update_added(GWidthTracker *tracker, size_t index, size_t c
tracker->portions = (common_metrics *)realloc(tracker->portions,
tracker->count * sizeof(common_metrics));
+ portion = &tracker->portions[current];
+
dest = current + 2;
src = current + 1;
@@ -535,6 +537,8 @@ void g_width_tracker_update_added(GWidthTracker *tracker, size_t index, size_t c
tracker->portions[current + 1].first = portion->first + 1;
tracker->portions[current + 1].last = portion->last;
+ tracker->portions[current + 1].cached = false;
+
portion->first = i;
portion->last = i;
@@ -546,6 +550,8 @@ void g_width_tracker_update_added(GWidthTracker *tracker, size_t index, size_t c
tracker->portions[current + 1].first = i;
tracker->portions[current + 1].last = portion->last;
+ tracker->portions[current + 1].cached = false;
+
portion->last = i - 1;
}