From 037138d3bf0be118a7e3559fef0a93667e6d1fe4 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 3 Jul 2011 16:43:17 -0400 Subject: [PATCH] clutter-text: Always update cursor positions when painting The cursor's on-screen rectangle is defined in terms of the text length, the current index, and text_x and text_y, which hold the text offset in overflowing text fields. When deleting large amounts of text, text_x is set to 0. In some edge case branch paths, the cursor rectangle could be calculated after the current index and text length were updated, but before the text_x offset could be. This left a negative x position, which consequently blew up Cogl and the widget. https://bugzilla.gnome.org/show_bug.cgi?id=651079 --- clutter/clutter-text.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 85912cc43..ea783ad91 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -2015,10 +2015,6 @@ clutter_text_paint (ClutterActor *self) text_x = text_x + (actor_width - cursor_x) - TEXT_PADDING; } } - /* Update the absolute cursor position as it may have moved due to - * scrolling */ - priv->text_x = text_x; - clutter_text_ensure_cursor_position (text); } else { @@ -2028,7 +2024,11 @@ clutter_text_paint (ClutterActor *self) else text_x = 0; - priv->text_x = text_x; + if (priv->text_x != text_x) + { + priv->text_x = text_x; + clutter_text_ensure_cursor_position (text); + } real_opacity = clutter_actor_get_paint_opacity (self) * priv->text_color.alpha