On 7/20/12 6:28 PM, Martin Hewitson wrote:
Dear list,

In my app I have a user action which allows them to select a particular line in 
a PDFView. The relevant method (on my PDFView subclass) looks like this.

- (void)displayLineAtPoint:(NSPoint)point inPageAtIndex:(NSUInteger)pageIndex
{
   if (pageIndex < [[self document] pageCount]) {
     [[self window] makeFirstResponder:self];
     PDFPage *page = [[self document] pageAtIndex:pageIndex];
     PDFSelection *sel = [page selectionForLineAtPoint:point];
     [self performSelectorOnMainThread:@selector(goToPage:) withObject:page 
waitUntilDone:YES];
     [self setCurrentSelection:sel];
     [self scrollSelectionToVisible:self];
     [self display];
     [self setCurrentSelection:nil];
     [self performSelector:@selector(setCurrentSelectionAndAnimate:) 
withObject:sel afterDelay:0.2];
   }
}

[self performSelectorOnMainThread:@selector(goToPage:) withObject:page waitUntilDone:YES];

looks suspicious. If you're doing this on a secondary thread (which this line implies), I'm pretty sure that at least the call to -makeFirstResponder: is illegal (main thread only). Not sure about the PDF document class.

Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to