Path: utzoo!news-server.csri.toronto.edu!rutgers!psuvax1!wuarchive!sdd.hp.com!ucsd!network.ucsd.edu!weber.ucsd.edu!pbiron From: garp!pbiron@keynes.ucsd.edu (Paul Biron) Newsgroups: comp.sys.next Subject: unofficial patch for Acceptor demo Summary: patch for IconView class which prevents the WorkSpace from dieing Keywords: Acceptor, IconView Message-ID: <4926@network.ucsd.edu> Date: 11 Mar 91 19:36:57 GMT Sender: news@network.ucsd.edu Organization: Division of Social Sciences, UCSD Lines: 78 Nntp-Posting-Host: weber.ucsd.edu Originator: pbiron@weber.ucsd.edu Hi all, I spent alittle time this weekend playing with the Acceptor demo, since I needed to implement Drag-and-Drop from the WorkSpace in an app I'm writting. The demo is really good, for those who haven't checked it out (thanx Jason). However, I did find one bug in the IconView class. The bug is that if a mouseDown: event gets to the IconView when there is no image in it (i.e. clicking in the icon well before you've dragged an icon into to). In this case, the WorkSpace tries to drag a non-existent window and the windowserver/WorkSpace gets a bus error, core dumps and logs you off. Included below is the patch that I used in the app that I'm writting. The idea is easy, in the clear method make sure the filename instance variable is emptied and check for this condition in the mouseDown: method before trying to drag the icon. ----------------------------------------------------------------------- Fighting for peace is like fucking for virginity! ----------------------------------------------------------------------- Paul Biron garp!pbiron@keynes.ucsd.edu (can have NeXT attachments) SnUG/SIGHaCK pbiron@ucsd.edu (normal net mail) "Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read." --Groucho Marx ---------------------------------Cut Here------------------------------ *** IconView.patch Mon Mar 11 11:18:16 1991 --- /NextDeveloper/Examples/Acceptor/IconView.m Sat Oct 13 23:13:21 1990 *************** *** 77,89 **** NXRectFill(&bounds); [iconImage unlockFocus]; - /* - * emtpy the filename so that subsequent mouseDown events - * don't try to drag the icon (see mouseDown: below), which - * causes the windowserver/WorkSpace Manager to die - * [added by garp!pbiron@keynes.ucsd.eud, Mon Mar 11 11:18:14 1991] - */ - *filename = '\0' ; - /* now display the blank nximage */ showFile = NO; [self display]; --- 77,82 ---- *************** *** 115,121 **** - mouseDown:(NXEvent *)theEvent { ! if (*filename && !multipleFiles) { [self dragFile:filename fromRect:&fileRect slideBack:YES --- 108,114 ---- - mouseDown:(NXEvent *)theEvent { ! if (!multipleFiles) { [self dragFile:filename fromRect:&fileRect slideBack:YES *************** *** 125,128 **** return self; } - @end --- 118,120 ---- -- Paul Biron pbiron@ucsd.edu (619) 534-5758 Central University Library, Mail Code C-075-R Social Sciences DataBase Project University of California, San Diego, La Jolla, Ca. 92093