Index: Source/core/html/canvas/WebGLRenderingContext.cpp |
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp |
index 0ce2dae23a2f48913281fdb63c9cf7476b175f69..4ab9f298b72ded6ed6e751ea2ef4a0352be8a185 100644 |
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp |
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp |
@@ -2702,19 +2702,21 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG |
if (!m_context->getActiveUniform(objectOrZero(program), i, info)) |
return WebGLGetInfo(); |
String name = info.name; |
+ StringBuilder nameBuilder; |
// Strip "[0]" from the name if it's an array. |
if (info.size > 1 && name.endsWith("[0]")) |
info.name = name.left(name.length() - 3); |
// If it's an array, we need to iterate through each element, appending "[index]" to the name. |
for (GLint index = 0; index < info.size; ++index) { |
- name = info.name; |
+ nameBuilder.clear(); |
+ nameBuilder.append(info.name); |
if (info.size > 1 && index >= 1) { |
- name.append('['); |
- name.append(String::number(index)); |
- name.append(']'); |
+ nameBuilder.append('['); |
+ nameBuilder.append(String::number(index)); |
+ nameBuilder.append(']'); |
} |
// Now need to look this up by name again to find its location |
- GLint loc = m_context->getUniformLocation(objectOrZero(program), name.utf8().data()); |
+ GLint loc = m_context->getUniformLocation(objectOrZero(program), nameBuilder.toString().utf8().data()); |
if (loc == location) { |
// Found it. Use the type in the ActiveInfo to determine the return type. |
GLenum baseType; |