Unverified Commit 3a212464 authored by Charlles R. A. Abreu's avatar Charlles R. A. Abreu Committed by GitHub
Browse files

Initialize pinnedBuffer at OpenCLContext creation (#3842)

This initialization is needed to prevent segfault during object destruction in certain circumstances (e.g., when a `Force` is changed before calling `Context.reinitialize()` and this change causes the corresponding `ForceImpl` to throw an exception).
parent a6a05ee6
...@@ -79,7 +79,7 @@ static bool isSupported(cl::Platform platform) { ...@@ -79,7 +79,7 @@ static bool isSupported(cl::Platform platform) {
OpenCLContext::OpenCLContext(const System& system, int platformIndex, int deviceIndex, const string& precision, OpenCLPlatform::PlatformData& platformData, OpenCLContext* originalContext) : OpenCLContext::OpenCLContext(const System& system, int platformIndex, int deviceIndex, const string& precision, OpenCLPlatform::PlatformData& platformData, OpenCLContext* originalContext) :
ComputeContext(system), platformData(platformData), numForceBuffers(0), hasAssignedPosqCharges(false), ComputeContext(system), platformData(platformData), numForceBuffers(0), hasAssignedPosqCharges(false),
integration(NULL), expression(NULL), bonded(NULL), nonbonded(NULL) { integration(NULL), expression(NULL), bonded(NULL), nonbonded(NULL), pinnedBuffer(NULL) {
if (precision == "single") { if (precision == "single") {
useDoublePrecision = false; useDoublePrecision = false;
useMixedPrecision = false; useMixedPrecision = false;
......
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