llad@ur-tut.UUCP (Dennis Venable) (02/18/86)
This is a request for help with pasting PICT's. I am writing a desk accessory that is about 8k in length. I want to be able to paste a picture into the accessory from desk scrap. My accessory seems to work when in MacWrite, but from Finder it always crashes in the ROM's. I allocate a zero-length handle in the open routine and use that for receiving the picture. When an accPaste event is posted, the accessory reads the PICT from scrap and returns a the handle as expected. However, shortly after I DrawPicture, I call GetFontInfo to return font information. The system always crashes in this call to GetFontInfo in the ROM's with the Finder as the application. The picture I have been testing with is only thirty-five (35) bytes long so I should not be walking on the stack. If I remove the GetFontInfo call, it will crash at some other Quickdraw call, such as EraseRect. If anyone out there can give me a hint as to what I need to do, please do so. Thanks in advance! Code segments are as follows (in Aztec C): ... Picture **picH; ... open() { ... picH = (Picture **)NewHandle(0L); ... } doEvent() { ... case accPaste: fromDeskScrap(); break; ... } fromDeskScrap() { long io,len; io = GetScrap(picH,'PICT',&len); if (io == -102) { noPict(); return; } DrawPicture(picH,&(**picH).picFrame); doOtherStuff(); KillPicture(); } doOtherStuff() { ... GetFontInfo(); ... } Again, thanks for any help you can give! /Dennis L. Venable USENET: ...!rochester!ur-tut!llad