diff --git a/src/pypdfium2/_helpers/page.py b/src/pypdfium2/_helpers/page.py index 38c7ab4be..bff335f5e 100644 --- a/src/pypdfium2/_helpers/page.py +++ b/src/pypdfium2/_helpers/page.py @@ -283,8 +283,8 @@ def get_objects(self, filter=None, max_depth=2, form=None, level=0): if raw_obj is None: raise PdfiumError("Failed to get page object.") + # Not a child object, because the lifetime of pageobjects that are part of a page is managed by pdfium. The .page reference is enough to keep the parent alive, unless the caller explicitly closes it (which may not merit storing countless of weakrefs). helper_obj = PdfObject(raw_obj, page=self, pdf=self.pdf, level=level) - self._add_kid(helper_obj) if not filter or helper_obj.type in filter: yield helper_obj