Commit 6260b7aa by Bruce Dawson Committed by Jamie Madill

Fix kResourceTypeNames initialization

Due to a missing comma the kResourceTypeNames array contained a single long (concatenated) string instead of NumResourceTypes independent strings. This incorrect initialization caused a crash in out-of-memory situations, but this was only noticed on VC++ 2017 for some reason. This fix adds the missing comma and uses a static_assert to ensure that the array is initialized correctly. BUG=chromium:727671,728226,731089 Change-Id: I9f0f3d3725b9f773505506513afb6c349db3a7fb Reviewed-on: https://chromium-review.googlesource.com/539536Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3cd0dd37
...@@ -317,10 +317,13 @@ gl::Error ClearResource(Renderer11 *renderer, ...@@ -317,10 +317,13 @@ gl::Error ClearResource(Renderer11 *renderer,
return gl::NoError(); return gl::NoError();
} }
#define ANGLE_RESOURCE_STRINGIFY_OP(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) #RESTYPE #define ANGLE_RESOURCE_STRINGIFY_OP(NAME, RESTYPE, D3D11TYPE, DESCTYPE, INITDATATYPE) #RESTYPE,
constexpr std::array<const char *, NumResourceTypes> kResourceTypeNames = { constexpr std::array<const char *, NumResourceTypes> kResourceTypeNames = {
{ANGLE_RESOURCE_TYPE_OP(Stringify, ANGLE_RESOURCE_STRINGIFY_OP)}}; {ANGLE_RESOURCE_TYPE_OP(Stringify, ANGLE_RESOURCE_STRINGIFY_OP)}};
static_assert(kResourceTypeNames[NumResourceTypes - 1] != nullptr,
"All members must be initialized.");
} // anonymous namespace } // anonymous namespace
// ResourceManager11 Implementation. // ResourceManager11 Implementation.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment