summaryrefslogtreecommitdiff
path: root/gui-libs/gtk/files/gtk-4.10.3-crash-css-color.patch
blob: df8781a73a6c9f5d22a49f529365a51737f4ba7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
https://gitlab.gnome.org/GNOME/gtk/-/commit/966a23503a2e8bbb948270e06f3eb13ca4c06632

From 966a23503a2e8bbb948270e06f3eb13ca4c06632 Mon Sep 17 00:00:00 2001
From: Benjamin Otte <otte@redhat.com>
Date: Tue, 2 May 2023 19:48:54 +0200
Subject: [PATCH] css: Don't transition to currentColor

Transition to the color that is in use instead.

Fixes crashes because currentColor is not an RGBA color and
therefor could not be queried later.

Fixes #5798
--- a/gtk/gtkcssfiltervalue.c
+++ b/gtk/gtkcssfiltervalue.c
@@ -102,10 +102,10 @@ gtk_css_filter_clear (GtkCssFilter *filter)
 }
 
 static void
-gtk_css_filter_init_identity (GtkCssFilter     *filter,
-                              GtkCssFilterType  type)
+gtk_css_filter_init_identity (GtkCssFilter       *filter,
+                              const GtkCssFilter *other)
 {
-  switch (type)
+  switch (other->type)
     {
     case GTK_CSS_FILTER_BRIGHTNESS:
       filter->brightness.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
@@ -135,7 +135,7 @@ gtk_css_filter_init_identity (GtkCssFilter     *filter,
       filter->blur.value = _gtk_css_number_value_new (0, GTK_CSS_PX);
       break;
     case GTK_CSS_FILTER_DROP_SHADOW:
-      filter->drop_shadow.value = gtk_css_shadow_value_new_filter ();
+      filter->drop_shadow.value = gtk_css_shadow_value_new_filter (other->drop_shadow.value);
       break;
     case GTK_CSS_FILTER_NONE:
     default:
@@ -143,7 +143,7 @@ gtk_css_filter_init_identity (GtkCssFilter     *filter,
       break;
     }
 
-  filter->type = type;
+  filter->type = other->type;
 }
 
 #define R 0.2126
@@ -466,7 +466,7 @@ gtk_css_value_filter_equal (const GtkCssValue *value1,
     {
       GtkCssFilter filter;
 
-      gtk_css_filter_init_identity (&filter, larger->filters[i].type);
+      gtk_css_filter_init_identity (&filter, &larger->filters[i]);
 
       if (!gtk_css_filter_equal (&larger->filters[i], &filter))
         {
@@ -590,7 +590,7 @@ gtk_css_value_filter_transition (GtkCssValue *start,
     {
       GtkCssFilter filter;
 
-      gtk_css_filter_init_identity (&filter, start->filters[i].type);
+      gtk_css_filter_init_identity (&filter, &start->filters[i]);
       gtk_css_filter_transition (&result->filters[i],
                                  &start->filters[i],
                                  &filter,
@@ -602,7 +602,7 @@ gtk_css_value_filter_transition (GtkCssValue *start,
     {
       GtkCssFilter filter;
 
-      gtk_css_filter_init_identity (&filter, end->filters[i].type);
+      gtk_css_filter_init_identity (&filter, &end->filters[i]);
       gtk_css_filter_transition (&result->filters[i],
                                  &filter,
                                  &end->filters[i],
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -331,7 +331,7 @@ gtk_css_shadow_value_new (ShadowValue *shadows,
 }
 
 GtkCssValue *
-gtk_css_shadow_value_new_filter (void)
+gtk_css_shadow_value_new_filter (const GtkCssValue *other)
 {
   ShadowValue value;
 
@@ -340,7 +340,7 @@ gtk_css_shadow_value_new_filter (void)
   value.voffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
   value.radius = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
   value.spread = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
-  value.color = _gtk_css_color_value_new_current_color ();
+  value.color = gtk_css_value_ref (other->shadows[0].color);
 
   return gtk_css_shadow_value_new (&value, 1, TRUE);
 }
--- a/gtk/gtkcssshadowvalueprivate.h
+++ b/gtk/gtkcssshadowvalueprivate.h
@@ -35,7 +35,7 @@
 G_BEGIN_DECLS
 
 GtkCssValue *   gtk_css_shadow_value_new_none         (void);
-GtkCssValue *   gtk_css_shadow_value_new_filter       (void);
+GtkCssValue *   gtk_css_shadow_value_new_filter       (const GtkCssValue        *other);
 
 GtkCssValue *   gtk_css_shadow_value_parse            (GtkCssParser             *parser,
                                                        gboolean                  box_shadow_mode);
-- 
GitLab