NSPasteboard in Carbon App
NSPasteboard in Carbon App
- Subject: NSPasteboard in Carbon App
- From: Martin Häcker <email@hidden>
- Date: Mon, 2 Aug 2004 09:44:53 +0200
Hi there,
when using NSPasteboard from a carbon App (a Finder contextual-menu)
I'm getting errors that it autoreleases a strings and mutabledata
without an autorelease pool in place - i.e. it's just leaking them.
The code I use is this:
--- snip ---
// This damn pasteboard is leaking like a sieve
// because there is no autorelease pool around in the finder
// How does one solve this?
void putStringOnClipboard(CFStringRef aString) {
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:[NSArray
arrayWithObject:NSStringPboardType] owner:nil];
[pasteboard setString: (NSString *) aString forType:NSStringPboardType];
}
--- snap ---
The autorelease pool is setup and released in the method that calls
this one so I don't need an extra one here.
The error is:
--- snip ---
2004-08-02 09:38:15.500 Finder[13069] *** _NSAutoreleaseNoPool():
Object 0x6434e70 of class NSConcreteMutableData autoreleased with no
pool in place - just leaking
2004-08-02 09:38:15.500 Finder[13069] *** _NSAutoreleaseNoPool():
Object 0x642d500 of class NSCFString autoreleased with no pool in
place - just leaking
--- snap ---
So: How do I tell the pasteboard to _not_ autorelease some stuff
later? Or should I just ignore those warnings? I couldn't find
anything in the cocoa wiki or with google - so this list is once
again my last hope...
:)
Thanks for any tip,
cu Martin
--
dont.wanna.tell
[ot]coder - hehe
_______________________________________________
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.