Re: Problem Ejecting Discs
Re: Problem Ejecting Discs
- Subject: Re: Problem Ejecting Discs
- From: Shawn Erickson <email@hidden>
- Date: Fri, 21 Nov 2003 09:09:41 -0800
On Nov 21, 2003, at 2:11 AM, Patrick Machielse wrote:
I have an NSImageView displaying a pdf located on a mounted CD. When I
try
to eject the CD using:
[myImageView setImage:nil];
[[NSWorkspace sharedWorkspace]
unmountAndEjectDeviceAtPath:@"myPath"];
It fails. Somehow the ImageView keeps the pdf file open on the device,
preventing a successful eject.
In 'lab' conditions, I replaced the NSImageView with a subclass of
NSView
which draws an NSImage (home made NSImageView). Now the above code
_does_
work. Sadly, in my 'real world' program I couldn't replicate this
result.
Someone must have struggled with this before. Please help! Is there
some
known 'art' of ejecting removable discs? Can I check beforehand if the
NS(Image)View has a pointer to a file on disc? And what to do if it
has?
How do you create the image that is shown in the NSImageView? How is it
released? Is it released before you attempt your unmount? Need a little
more information so I am going to assume some things...
You could try using NSImage's setDataRetained:(bool) and set it to
retain the data.
An alternative is to load the file data into an NSData object and use
that object to construct the image.
-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.