fix memory management problem
This commit is contained in:
parent
5474935a81
commit
f91f55927e
@ -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()
|
|||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user