mrc@Tomobiki-Cho.CAC.Washington.EDU (Mark Crispin) (06/14/90)
Does your application crash in terminate:, leaving behind a nasty core file? Are you frustrated when you gdb it, only to find that all that's on the stack is that terminate: called objc_msgSend()? It turns out that it's a bug that's purportedly fixed in 2.0. What happens is that terminate: goes around freeing everything, and finally comes to freeing the pasteboard. The pasteboard wants to talk to its owner, and if the owner has already been freed then it crashes with a segmentation fault in objc_msgSend(). The way around this problem is to make sure that the pasteboard's owner is a factory object. For example, here's a sample terminate: method for your Application object which gets a confirmation and makes sure the pasteboard won't crash us. - terminate:sender { // get a confirmation if (NXRunAlertPanel ("Quit?","Do you really want to Quit?",NIL,"Cancel", NIL)) { // work around 1.0 bug [[NXApp pasteboard] declareTypes:&NXAsciiPboard num:1 owner:[self class]]; [super terminate:sender]; // do superior's terminate: action } return self; } _____ | ____ ___|___ /__ Mark Crispin, 206 842-2385, R90/6 pilot, DoD#0105 _|_|_ -|- || __|__ / / 6158 Lariat Loop NE "Gaijin! Gaijin!" |_|_|_| |\-++- |===| / / Bainbridge Island, WA "Gaijin ha doko ka?" --|-- /| |||| |___| /\ USA 98110-2098 "Niichan ha gaijin." /|\ | |/\| _______ / \ "Chigau. Gaijin ja nai. Omae ha gaijin darou" / | \ | |__| / \ / \"Iie, boku ha nihonjin." "Souka. Yappari gaijin!" Hee, dakedo UNIX nanka wo tsukatte, umaku ikanaku temo shiranai yo.