pbiron@keynes.ucsd.edu (Paul Biron) (03/12/91)
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