Decrement context ref count as a last action in program destructor.

- There are various calls to device inside destructor.
- Memory manager is protected via device , which is protected by context.
- If context is destroyed it means that device may be destroyed, which means
that memory manager may be destroyed and we have a seg fault.

Change-Id: I2cb6a69790f53bf2c9fba89160078b009e105574
This commit is contained in:
Mrozek, Michal
2018-06-28 09:01:51 +02:00
parent 887df5a90d
commit b7545f1401
2 changed files with 19 additions and 3 deletions

View File

@@ -98,9 +98,6 @@ Program::Program(Context *context, bool isBuiltIn) : context(context), isBuiltIn
}
Program::~Program() {
if (context && !isBuiltIn) {
context->decRefInternal();
}
delete[] genBinary;
genBinary = nullptr;
@@ -129,6 +126,9 @@ Program::~Program() {
pDevice->getMemoryManager()->checkGpuUsageAndDestroyGraphicsAllocations(globalSurface);
globalSurface = nullptr;
}
if (context && !isBuiltIn) {
context->decRefInternal();
}
}
cl_int Program::createProgramFromBinary(