From 2301e73f23636e86926c67a005fcca0fa5cc0073 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 7 Jan 2025 21:13:43 -0500 Subject: [PATCH] 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. --- gtk/gtktextlayout.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 11a7636f95..2f1366391e 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -4112,6 +4112,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout, if (line_display->height > 0) { g_assert (line_display->layout != NULL); + g_assert (!line_display->cursors_invalid); if (have_selection) {