From f221f57c7cdf23055f79eb50bd9d4b0b4f42c703 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 27 Dec 2013 14:02:03 +0400 Subject: [PATCH] this commit prevents segfaults in case of opencl disabled --- modules/core/src/ocl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 7b64440513..9b7564250f 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -2306,7 +2306,11 @@ bool Context2::create(int dtype0) Context2::~Context2() { - p->release(); + if (p) + { + p->release(); + p = NULL; + } } Context2::Context2(const Context2& c) @@ -2329,7 +2333,7 @@ Context2& Context2::operator = (const Context2& c) void* Context2::ptr() const { - return p->handle; + return p == NULL ? NULL : p->handle; } size_t Context2::ndevices() const