TIFFRepresentation/NSDragPboard issues
TIFFRepresentation/NSDragPboard issues
- Subject: TIFFRepresentation/NSDragPboard issues
- From: "Jeffrey E. Forcier" <email@hidden>
- Date: Wed, 21 Sep 2005 18:16:36 -0400
Greets all,
I'm using Cocoa (via the Python Objective-C bridge; yes, I've also
posted on their list in case it's a bug on their end) to try and add
dragging capabilities to a subclassed NSImageView (so that one can
drag both from *and* to them, instead of just to them) and have run
into an exceptionally irritating problem or two.
The *short* of it is that I first attempt to get a small JPEG-derived
NSImage's TIFFRepresentation, which causes 90+% CPU usage and
effectively hangs the test application. Afterwards, any attempts by
any application to access the global drag pasteboard, causes a
similar spike-and-hang, including hangs for things which don't appear
directly related to draggin (like launching an application). This
pretty much forces me to reboot.
If you're interested in the details, here's the long of it:
Below is the code as-is, including some mucking around I'm in the
middle of while trying to solve the problem. This inside the
subclass's mouseDown_() method (note that 'self.image()' is a normal
NSImage object which has been initialized via a filename in code):
pb = NSPasteboard.pasteboardWithName_(NSDragPboard)
pb.declareTypes_owner_(NSArray.arrayWithObject_(NSTIFFPboardType),self)
pb.setData_forType_(self.image().TIFFRepresentation(),NSTIFFPboardType)
NSView.dragImage_at_offset_event_pasteboard_source_slideBack_
(self,self.image(),
NSPoint(0.0,0.0),self.image().size(),theEvent,pb,self.window
(),objc.YES)
The problems are twofold, but probably very closely related:
1. When the third line is called, specifically the 'self.image
().TIFFRepresentation()' method (I've tested a bit to make sure that
is in fact the problem method) my CPU usage spikes to 85+ percent and
doesn't come down after a good ten to twenty seconds.
I'd test it for even longer just to see what happens, but see #2. I'm
not sure why this happens--the image in question is a 180x240 pixel
JPEG (only 20kb in size) so I can't figure out why getting the
TIFFRepresentation would cause such an issue.
2. This is the really annoying part--after killing the application
when it causes a CPU spike as in #1, *any attempts to access the
global drag pasteboard causes a similar CPU spike and effectively
freezes the app in question*.
This happens both when running my PyObjC app a second time; when
making a 'NSPasteboard.pasteboardWithName_(NSDragPboard)' call in the
Python interpreter; when attempting to drag stuff in other apps like
InterfaceBuilder; and even at other times which do not immediately
appear associated with dragging, such as launching applications (and
whatever iCal Helper does on a regular basis--its process suddenly
exhibited that same tendency out of the blue, without iCal even being
open).
Clearly there's either some bug I'm running into here, or I am doing
something very wrong. Help!
Thanks,
Jeff
--
Jeffrey E. Forcier
Junior Developer, Research and Development
Stroz Friedberg, LLC
15 Maiden Lane, 12th Floor
New York, NY 10038
[main]212-981-6540 [direct]212-981-6546
http://www.strozllc.com
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No right to
confidential or privileged treatment of this message is waived or lost
by any error in transmission. If you have received this message in
error, please immediately notify the sender by e-mail or by telephone at
212.981.6540, delete the message and all copies from your system and
destroy any hard copies. You must not, directly or indirectly, use,
disclose, distribute, print or copy any part of this message if you are
not the intended recipient.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden