Merge pull request #4136 from alalek:fix_matallocator_destruction

This commit is contained in:
Vadim Pisarevsky
2015-06-22 11:49:36 +00:00
2 changed files with 13 additions and 4 deletions

View File

@@ -5237,10 +5237,15 @@ public:
MatAllocator* matStdAllocator;
};
// This line should not force OpenCL runtime initialization! (don't put "new OpenCLAllocator()" here)
static MatAllocator *ocl_allocator = NULL;
MatAllocator* getOpenCLAllocator()
{
static MatAllocator * allocator = new OpenCLAllocator();
return allocator;
if (ocl_allocator == NULL)
{
ocl_allocator = new OpenCLAllocator();
}
return ocl_allocator;
}
}} // namespace cv::ocl