Re: PDFDocument, ARC and 10.9 question
Re: PDFDocument, ARC and 10.9 question
- Subject: Re: PDFDocument, ARC and 10.9 question
- From: Totte Alm <email@hidden>
- Date: Fri, 17 Jan 2014 19:07:06 +0100
17 jan 2014 kl. 18:43 skrev David Duncan <email@hidden>:
> Your problem is likely well before that point, since it looks like the failure has to do with a font. Either the font is damaged somehow, or the reference is invalid.
I thought so too, and the fact that running the app from Instruments has no problems at all made me wonder what was going on.
So I isolated the problem to to what I showed here. Displaying, writing or printing crashes the same way unless running under Instruments, then it all works.
Does instruments do something when running that would "fix" an invalid reference? I run in XCode both with and without zombiew hunting mode and nothing shows in Instruments, which I've used to trap several other results of GC -> ARC failures.
/ Totte
>
> On Jan 17, 2014, at 4:22 AM, Totte Alm <email@hidden> wrote:
>
>> Hello again,
>>
>> Still debugging my CG -> ARC move and I'm stuck with one problem that I just can't understand.
>>
>> DEBUG SNIP WHERE THIS HAPPENS
>> _thePDF = [[PDFDocument alloc] initWithData:_data];
>> // test-
>> if (_thePDF) {
>> @try {
>> *CRASHES HERE* -> [_thePDF writeToFile:[NSString stringWithFormat:@"%@/PDFtemp-%f-h.pdf", NSTemporaryDirectory(), [[NSDate date] timeIntervalSince1970]]];
>> }
>> @catch (NSException *exception) {
>> NSLog(@"Ex:%@", [exception description]);
>> }
>> @finally {
>> // None
>> ;
>> }
>> }
>> // - test
>>
>> This code crashes with the dump below, but only when running from XCode. If I run the app under instruments (using zombies or allications) it works as expected.
>> Anyone has a Ptr on what I'm missing.
>>
>> Thread 1, Queue : com.apple.main-thread
>> #0 0x00007fff8e1e8def in __cxa_throw ()
>> #1 0x00007fff8e65621a in TcmapEncodingTable::GetSubtable(unsigned short, unsigned short, unsigned short, unsigned short*) ()
>> #2 0x00007fff8e66852b in TcmapEncodingTable::TcmapEncodingTable(TSFNTFont const&, unsigned short, unsigned short, unsigned short) ()
>> #3 0x00007fff8e6858a5 in FPFontGetTrueTypeEncoding ()
>> #4 0x00007fff97090888 in get_truetype_encoding ()
>> #5 0x00007fff926aeb32 in CGFontGetTrueTypeEncoding ()
>> #6 0x00007fff926ae919 in lookup_glyphs_by_cmap_nonsymbolic ()
>> #7 0x00007fff926ae75c in lookup_glyphs_by_cmap ()
>> #8 0x00007fff926ae6ed in get_truetype_glyph_vector ()
>> #9 0x00007fff926adf53 in CGPDFEncodingGetGlyphVector ()
>> #10 0x00007fff926ada20 in simple_draw ()
>> #11 0x00007fff926ad96a in CGPDFTextLayoutDrawGlyphs ()
>> #12 0x00007fff926ac0e1 in op_TJ ()
>> #13 0x00007fff9264144d in pdf_scanner_handle_xname ()
>> #14 0x00007fff92640753 in CGPDFScannerScan ()
>> #15 0x00007fff9263ea53 in CGPDFDrawingContextDrawPage ()
>> #16 0x00007fff9263e808 in pdf_page_draw_in_context ()
>> #17 0x00007fff9263e7a8 in CGContextDrawPDFPage ()
>> #18 0x00007fff900f9d77 in -[PDFPage(PDFPagePrivate) drawWithBox:inContext:] ()
>> #19 0x00007fff900f4f31 in -[PDFDocument(PDFDocumentInternal) writeToConsumer:withOptions:] ()
>> #20 0x00007fff900f11e9 in -[PDFDocument writeToURL:withOptions:] ()
>> #21 0x00007fff900f10c6 in -[PDFDocument writeToFile:withOptions:] ()
>> #22 0x00007fff900f1083 in -[PDFDocument writeToFile:] ()
>> #23 0x00000001000d5549 in -[FlaggingsObject getPreview:] at xxx/FlaggingsObject.m:107
>>
>> Btw, thx Ken Tomases for the "tampoline" idea, works perfect.
>>
>> / Totte
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>
> --
> David Duncan
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden