Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue about the _sweepIndirectReferences function #26

Open
Eladio opened this issue Jun 17, 2011 · 1 comment
Open

Issue about the _sweepIndirectReferences function #26

Eladio opened this issue Jun 17, 2011 · 1 comment

Comments

@Eladio
Copy link

Eladio commented Jun 17, 2011

I think there's a little problem in the PdfFileWriter class' _sweepIndirectReferences function. There's a list called self.stack where the indirect references that we've already seen are stored. I suppose that it is used so that we don't sweep the same indirect reference over and over again. However in the function after it's sweeped once it is removed from self.stack, I don't see the point of that. If there are lots of objects referencing the same object ( for example if we copy the Logical Structure of the pdf as well, many objects reference the same page object wich is quite expensive to sweep ) mantaining it in self.stack could mean significant improvement in time.

if data.pdf == self:
            if data.idnum in self.stack:
                return data
            else:
                self.stack.append(data.idnum)
                realdata = self.getObject(data)
                self._sweepIndirectReferences(externMap, realdata)
                self.stack.pop()
                return data

I think it should be:

if data.pdf == self:
            if data.idnum in self.stack:
                return data
            else:
                self.stack.append(data.idnum)
                realdata = self.getObject(data)
                self._sweepIndirectReferences(externMap, realdata)
                return data
@AeroNotix
Copy link

Hi,

This fixes an issue I was having with certain kinds of documents getting stuck in a recursive loop in the self._sweepIndirectReferences call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants