this commit prevents segfaults in case of opencl disabled

This commit is contained in:
Ilya Lavrenov 2013-12-27 14:02:03 +04:00
parent 4644a864a5
commit f221f57c7c

View File

@ -2305,8 +2305,12 @@ bool Context2::create(int dtype0)
} }
Context2::~Context2() Context2::~Context2()
{
if (p)
{ {
p->release(); p->release();
p = NULL;
}
} }
Context2::Context2(const Context2& c) Context2::Context2(const Context2& c)
@ -2329,7 +2333,7 @@ Context2& Context2::operator = (const Context2& c)
void* Context2::ptr() const void* Context2::ptr() const
{ {
return p->handle; return p == NULL ? NULL : p->handle;
} }
size_t Context2::ndevices() const size_t Context2::ndevices() const