#1029: Possible PDFKit bug ----------------------------------+----------------------------------------- Reporter: yasuimao@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- I encountered an error using block with PDFDocument's findString:withOptions: Sample.rb {{{ #!/usr/local/bin/macruby framework 'cocoa';framework 'Quartz' PDFDocument.alloc.initWithURL(NSURL.fileURLWithPath("sample.pdf")).findString("the",withOptions:NSCaseInsensitiveSearch).each{|x| p x.string} }}} 'sample.pdf' is an academic journal PDF with about 12000 words in English. Along with this, I also tried .map{|x| x.string} instead of .each{} and got the same errors. The error messages I got are (multiple, all while processing the block): {{{ => NSInvalidArgumentException: -[CPCharacterIndex count]: unrecognized selector sent to instance (RuntimeError Error) => NSRangeException: *** -[NSCFArray objectAtIndex:]: index (220) beyond bounds (2) (RuntimeError) => [CPZoneBorderIntersection count]: unrecognized selector sent to instance => Segmentation fault }}} As suggested by Laurent, I set GC_DISABLE = 1 when I run this script (though I'm not sure if I did it correctly). Then this script ran without any problem. {{{ $ GC_DISABLE=1 macruby sample.rb => expected result ("the"/"The") }}} Also, without using block, I got an array of PDFSelection objects without an error. {{{ p PDFDocument.alloc.initWithURL(NSURL.fileURLWithPath("sample.pdf")).findString("the",withOptions:NSCaseInsensitiveSearch) => an array of "PDFSelection" objects }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1029> MacRuby <http://macruby.org/>