fix memory management problem

pull/2218/head
Alexander Alekhin 11 years ago
parent 5474935a81
commit f91f55927e
  1. 3
      modules/core/include/opencv2/core/ocl.hpp
  2. 20
      modules/core/src/ocl.cpp

@ -561,6 +561,9 @@ public:
explicit PlatformInfo2(void* id);
~PlatformInfo2();
PlatformInfo2(const PlatformInfo2& i);
PlatformInfo2& operator =(const PlatformInfo2& i);
String name() const;
String vendor() const;
String version() const;

@ -3707,6 +3707,26 @@ PlatformInfo2::~PlatformInfo2()
p->release();
}
PlatformInfo2::PlatformInfo2(const PlatformInfo2& i)
{
if (i.p)
i.p->addref();
this->p = i.p;
}
PlatformInfo2& PlatformInfo2::operator =(const PlatformInfo2& i)
{
if (i.p != this->p)
{
if (i.p)
i.p->addref();
if (this->p)
this->p->release();
this->p = i.p;
}
return *this;
}
int PlatformInfo2::deviceNumber() const
{
return p ? (int)p->devices.size() : 0;

Loading…
Cancel
Save