提交 f91f5592 编写于 作者: A Alexander Alekhin

fix memory management problem

上级 5474935a
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册