Commit f91f5592 authored by Alexander Alekhin's avatar Alexander Alekhin

fix memory management problem

parent 5474935a
...@@ -561,6 +561,9 @@ public: ...@@ -561,6 +561,9 @@ public:
explicit PlatformInfo2(void* id); explicit PlatformInfo2(void* id);
~PlatformInfo2(); ~PlatformInfo2();
PlatformInfo2(const PlatformInfo2& i);
PlatformInfo2& operator =(const PlatformInfo2& i);
String name() const; String name() const;
String vendor() const; String vendor() const;
String version() const; String version() const;
......
...@@ -3707,6 +3707,26 @@ PlatformInfo2::~PlatformInfo2() ...@@ -3707,6 +3707,26 @@ PlatformInfo2::~PlatformInfo2()
p->release(); 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 int PlatformInfo2::deviceNumber() const
{ {
return p ? (int)p->devices.size() : 0; return p ? (int)p->devices.size() : 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment