mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
LibPDF: Switch to automatic ref counting, fix memory leak
At least `Value::operator=` didn't properly unref the `PDF::Object` when it was called. This type of problem is removed by just letting `RefPtr` do its thing. This patch increases the memory consumption by LibPDF by 4 bytes (the other union objects) per value.
This commit is contained in:
parent
05006e63c4
commit
750bed254f
2 changed files with 3 additions and 12 deletions
|
@ -9,12 +9,6 @@
|
|||
|
||||
namespace PDF {
|
||||
|
||||
Value::~Value()
|
||||
{
|
||||
if (is_object())
|
||||
m_as_object->unref();
|
||||
}
|
||||
|
||||
Value& Value::operator=(Value const& other)
|
||||
{
|
||||
m_type = other.m_type;
|
||||
|
@ -36,8 +30,6 @@ Value& Value::operator=(Value const& other)
|
|||
break;
|
||||
case Type::Object:
|
||||
m_as_object = other.m_as_object;
|
||||
if (m_as_object)
|
||||
m_as_object->ref();
|
||||
break;
|
||||
}
|
||||
return *this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue