1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibPDF: Eliminate reference cycle between OutlineItem parent/children

Since all parents held a reference pointer to their children, and all
children held reference pointers to their parents, both objects would
never get free'd once the document was no longer being used.

Fixes ossfuzz-63833.
This commit is contained in:
Idan Horowitz 2023-12-02 12:58:39 +02:00 committed by Andreas Kling
parent 681771d210
commit aad5c58996

View file

@ -36,8 +36,9 @@ struct Destination {
Vector<Optional<float>> parameters;
};
struct OutlineItem final : public RefCounted<OutlineItem> {
RefPtr<OutlineItem> parent;
struct OutlineItem final : public RefCounted<OutlineItem>
, public Weakable<OutlineItem> {
WeakPtr<OutlineItem> parent;
Vector<NonnullRefPtr<OutlineItem>> children;
DeprecatedString title; // Already converted to UTF-8.
i32 count { 0 };