Fix double-release of memory objects (#1277)

A recent update to the object wrapper classes (#1268) changed the
behavior of assigning to a wrapper, whereby the wrapped object is now
released upon assignment. A couple of tests were manually calling
clReleaseMemObject and then assigning `nullptr` to the wrapper,
resulting in the wrapper calling clReleaseMemObject on an object that
had already been destroyed.
This commit is contained in:
James Price
2021-07-05 10:35:39 -04:00
committed by GitHub
parent 236cd73fa1
commit 4a03bb79cb
2 changed files with 1 additions and 13 deletions

View File

@@ -48,12 +48,7 @@ int test_mem_object_destructor_callback_single(clMemWrapper &memObject)
test_error(error, "Unable to set destructor callback");
// Now release the buffer, which SHOULD call the callbacks
error = clReleaseMemObject(memObject);
test_error(error, "Unable to release test buffer");
// Note: since we manually released the mem wrapper, we need to set it to
// NULL to prevent a double-release
memObject = NULL;
memObject.reset();
// At this point, all three callbacks should have already been called
int numErrors = 0;