Work around MSVC bug 746973.

MSVC has a long history of value initialization bugs, and this one is
no exception. In this case, when some MSVC versions (at least up to
2013) are instructed to value-initialize a non-POD class with
a compiler generated non-trivial constructor, it does not zero out
the POD members.
This commit is contained in:
whitequark 2019-05-23 20:49:54 +00:00
parent 9f2077b1f3
commit 43a59e212f
2 changed files with 4 additions and 2 deletions

View File

@ -181,7 +181,8 @@ public:
std::weak_ptr<const Pixmap> texture;
} current;
OpenGl1Renderer() : camera(), lighting(), current() {}
// List-initialize current to work around MSVC bug 746973.
OpenGl1Renderer() : camera(), lighting(), current({}) {}
const Camera &GetCamera() const override { return camera; }

View File

@ -88,11 +88,12 @@ public:
std::weak_ptr<const Pixmap> texture;
} current;
// List-initialize current to work around MSVC bug 746973.
OpenGl3Renderer() :
lines(), meshes(), points(), pixmapCache(), masks(),
initialized(), atlas(), meshRenderer(), imeshRenderer(),
edgeRenderer(), outlineRenderer(), camera(), lighting(),
current() {}
current({}) {}
void Init();