Merge branch 'css-variables-crash' into 'main'

css: Fix a crash in variables

Closes #6935

See merge request GNOME/gtk!7615
This commit is contained in:
Matthias Clasen 2024-08-15 15:15:48 +00:00
commit 7da4844dcc
4 changed files with 31 additions and 0 deletions

View File

@ -139,6 +139,10 @@ check_references (GtkCssVariableSet *self,
ref_value = g_hash_table_lookup (self->variables, GINT_TO_POINTER (ref_id));
/* This variable was already removed, no point in checking further */
if (!ref_value)
return FALSE;
if (check_variable (self, unvisited_variables, stack, ref_id, ref_value))
return TRUE;
}

View File

@ -0,0 +1,11 @@
:root {
--b: var(--a);
}
:root {
--a: var(--a, red);
}
* {
background: var(--b);
}

View File

@ -0,0 +1,9 @@
window.background:dir(ltr)
background-color: rgba(0,0,0,0); /* variables2.css:10:2-23 */
background-clip: border-box; /* variables2.css:10:2-23 */
background-origin: padding-box; /* variables2.css:10:2-23 */
background-size: auto; /* variables2.css:10:2-23 */
background-position: left top; /* variables2.css:10:2-23 */
background-repeat: repeat; /* variables2.css:10:2-23 */
background-image: none; /* variables2.css:10:2-23 */
--b: var(--a); /* variables2.css:2:8-16 */

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="decorated">0</property>
</object>
</interface>