1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:27:34 +00:00

LibPDF: Convert PDF::Parser::m_document from RefPtr to WeakPtr

Otherwise both `PDF::Document` and `PDF::Parser` have a `RefPtr`
pointing to each other which leads to a memory leak due to a circular
dependency.
This commit is contained in:
Simon Woertz 2021-11-28 11:52:48 +01:00 committed by Linus Groh
parent d8013f9c3a
commit c857b5d22f
3 changed files with 8 additions and 4 deletions

View file

@ -9,6 +9,7 @@
#include <AK/Format.h>
#include <AK/HashMap.h>
#include <AK/RefCounted.h>
#include <AK/Weakable.h>
#include <LibGfx/Color.h>
#include <LibPDF/ObjectDerivatives.h>
#include <LibPDF/Parser.h>
@ -70,7 +71,9 @@ struct OutlineDict final : public RefCounted<OutlineDict> {
OutlineDict() = default;
};
class Document final : public RefCounted<Document> {
class Document final
: public RefCounted<Document>
, public Weakable<Document> {
public:
static RefPtr<Document> create(ReadonlyBytes bytes);