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
This commit is contained in:
Jasper St. Pierre 2011-07-03 16:43:17 -04:00 committed by Emmanuele Bassi
parent e9a42f23fe
commit 037138d3bf

View File

@ -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