Commit 278bcb0
Don't use m_shader cache and create a new one for each draw https://bugs.webkit.org/show_bug.cgi?id=298220
Reviewed by Carlos Garcia Campos.
The usage of `m_shader` doesn't seem to be safe. It seems to me that a Gradient
might be used by different threads. They both can check that the shader is
not set and then try to create it. The first one creates it and then tries to
use it and the second one will then create a new one and free the first one.
I could see two threads that use `WebCore::Gradient::fill()` which ended
up in `SkShaderBase::makeContext()` crash.
This commit removes the `m_shader` cache and always creates a new shader for
each draw. This is probably more expensive, but maybe not that much.
If I remove the use of the shader cache, the crash goes away.
* Source/WebCore/platform/graphics/Gradient.h:
* Source/WebCore/platform/graphics/skia/GradientSkia.cpp:
(Gradient::shader): Modified
Canonical link: https://commits.webkit.org/299797@main1 parent d330a5d commit 278bcb0
File tree
2 files changed
+2
-10
lines changed- Source/WebCore/platform/graphics
- skia
2 files changed
+2
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 103 | | |
108 | 104 | | |
109 | 105 | | |
| |||
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
148 | | - | |
| 144 | + | |
149 | 145 | | |
150 | 146 | | |
151 | 147 | | |
| |||
170 | 166 | | |
171 | 167 | | |
172 | 168 | | |
173 | | - | |
| 169 | + | |
174 | 170 | | |
175 | 171 | | |
176 | 172 | | |
| |||
0 commit comments