gui/fading-label: Do not snapshot empty cached text node
When a label has empty text or an empty PangoLayout, gtk_snapshot_free_to_node() returns NULL. Passing NULL to gtk_snapshot_append_node() triggers a critical assertion failure which causes an abort under G_DEBUG=fatal-criticals. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/808>
This commit is contained in:
@@ -178,6 +178,9 @@ gcal_fading_label_snapshot (GtkWidget *widget,
|
|||||||
self->cached_text_node = gtk_snapshot_free_to_node (g_steal_pointer (&text_snapshot));
|
self->cached_text_node = gtk_snapshot_free_to_node (g_steal_pointer (&text_snapshot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!self->cached_text_node)
|
||||||
|
return;
|
||||||
|
|
||||||
if (self->cached_extents.x + self->cached_extents.width <= width)
|
if (self->cached_extents.x + self->cached_extents.width <= width)
|
||||||
{
|
{
|
||||||
gtk_snapshot_append_node (snapshot, self->cached_text_node);
|
gtk_snapshot_append_node (snapshot, self->cached_text_node);
|
||||||
|
|||||||
Reference in New Issue
Block a user