[vte] widget: Fix advance_tail if tail is not in the stream
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Fix advance_tail if tail is not in the stream
- Date: Mon, 17 Nov 2014 11:21:48 +0000 (UTC)
commit ecf7e0dafb95702a14c2e57e96b397600ccfc85b
Author: Egmont Koblinger <egmont gmail com>
Date: Mon Nov 17 12:19:16 2014 +0100
widget: Fix advance_tail if tail is not in the stream
https://bugzilla.gnome.org/show_bug.cgi?id=738964
src/ring.c | 6 +++---
src/vtestream-file.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index 267be8b..6eb3569 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -386,16 +386,16 @@ _vte_ring_discard_one_row (VteRing *ring)
ring->start++;
if (G_UNLIKELY (ring->start == ring->writable)) {
_vte_ring_reset_streams (ring, ring->writable);
- } else {
+ } else if (ring->start < ring->writable) {
VteRowRecord record;
_vte_stream_advance_tail (ring->row_stream, ring->start * sizeof (record));
if (G_LIKELY (_vte_ring_read_row_record (ring, &record, ring->start))) {
_vte_stream_advance_tail (ring->text_stream, record.text_start_offset);
_vte_stream_advance_tail (ring->attr_stream, record.attr_start_offset);
}
- }
- if (ring->start > ring->writable)
+ } else {
ring->writable = ring->start;
+ }
}
static void
diff --git a/src/vtestream-file.h b/src/vtestream-file.h
index 47954ba..5c709b4 100644
--- a/src/vtestream-file.h
+++ b/src/vtestream-file.h
@@ -464,6 +464,8 @@ _vte_file_stream_advance_tail (VteStream *astream, gsize offset)
{
VteFileStream *stream = (VteFileStream *) astream;
+ g_assert(offset <= stream->head);
+
if (offset >= stream->offset[0]) {
stream->offset[1] = stream->offset[0];
stream->offset[0] = stream->head;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]