• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDFView setDocument: autorelease crash?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDFView setDocument: autorelease crash?


  • Subject: Re: PDFView setDocument: autorelease crash?
  • From: John Calhoun <email@hidden>
  • Date: Mon, 12 Mar 2007 12:30:32 -0700


On Mar 10, 2007, at 6:52 AM, Keith Blount wrote:
// NOTE: to reset the PDFView properly, we have to go to the first page before setting the document to nil. If we don't
// do this, we get weird results when trying to go to a page after loading a new document. Weird, but it works...
[pdfView goToFirstPage:nil];
[pdfView setDocument:nil];

That's a little strange. -[setDocument] and -[goToFirstPage] both reset the page index to zero and reset the view layout. If anything - [goToFirstPage] is something of a redundant subset of -[setDocument]. What weird behavior are you seeing?


As far as I can see, all of this should work. However, users have been reporting various autorelease-type crashes related to PDF files, and today I finally managed to track the crash. It turns out that calling -setDocument over-releases the PDF document, for some reason. If I change my -loadPDFDocumentFromFile: method so that the PDFDocument does not get autoreleased, everything works fine with no crashes, as follows:

-[setDocument (on Tiger) autoreleases the current document and then retains the document passed in. I wonder if your extra retain is instead masking a bug/crash somewhere else.


In fact a bug has been found in Tiger that showed itself when re-using a single PDFView for different documents. It was related to PDFView's handling of tooltips (for Link annotations for example). The workaround was to either create a new PDFView for each PDFDocument or to instead turn off tooltips handling (PDFView subclass, implement - (void) [scheduleAddingToolips] and do nothing in this method).

That's the best my hazy recollection can offer up.

Is this a bug in PDFView, or have I missed something obvious?

A bug but as I say, I think elsewhere. Have you tried the code on Leopard? I believe these issues are fixed without requiring the workarounds. Before Leopard ships it would be nice to know if there is more work to do. :-)


john calhoun—

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >PDFView setDocument: autorelease crash? (From: Keith Blount <email@hidden>)

  • Prev by Date: Weird app window behavior on PowerPC-based Mac
  • Next by Date: Re: Terminal Framework?
  • Previous by thread: Re: PDFView setDocument: autorelease crash?
  • Next by thread: Core Data and Undo action names
  • Index(es):
    • Date
    • Thread