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
commit aad5c58996
Notes: sideshowbarker 2024-07-17 02:37:08 +09:00

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 };