text layout: Add an assertion

It is bad news if we end up in snapshot() with lines that are
(partially) invalid. For example, we may end up with the line
that contains the cursors having its cursors array purged,
causing us to not draw the blinking cursor despite us changing
cursor alpha in a tick callback.

Add an assertion to catch this when it happens.
This commit is contained in:
Matthias Clasen 2025-01-07 21:13:43 -05:00
parent 6edcaf1a43
commit 2301e73f23

View File

@ -4112,6 +4112,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
if (line_display->height > 0) if (line_display->height > 0)
{ {
g_assert (line_display->layout != NULL); g_assert (line_display->layout != NULL);
g_assert (!line_display->cursors_invalid);
if (have_selection) if (have_selection)
{ {