Re: NSStatusBar generates Sigtrap
Re: NSStatusBar generates Sigtrap
- Subject: Re: NSStatusBar generates Sigtrap
- From: Charilaos Skiadas <email@hidden>
- Date: Tue, 2 Aug 2005 10:39:30 -0500
On Aug 2, 2005, at 10:21 AM, Michael Gruetzner wrote:
Hello,
I've tried to add an item to the status bar. Therefore I wrote this
tiny program:
int main(int argc, char *argv[]) {
NSStatusItem *item;
NSStatusBar *bar = [[NSStatusBar systemStatusBar]retain];
item = [bar statusItemWithLength : NSVariableStatusItemLength];
[item retain];
[item setTitle: NSLocalizedString(@"Tablet",@"")];
[item setHighlightMode:YES];
[item setMenu:theMenu];
return 0;
}
I took the code from the example on the cocoa documentation. When I
run the code, the
It would be useful here to indicate where in the documentation this
example is, so that we can compare...
following happens:
Executable “event” has exited due to signal 5 (SIGTRAP).
[Session started at 2005-08-02 17:01:36 +0200.]
2005-08-02 17:01:37.130 event[2845] *** _NSAutoreleaseNoPool():
Object 0x325e80 of class NSCFString autoreleased with no pool in
place - just leaking
2005-08-02 17:01:37.131 event[2845] *** _NSAutoreleaseNoPool():
Object 0x325de0 of class NSException autoreleased with no pool in
place - just leaking
2005-08-02 17:01:37.132 event[2845] *** Uncaught exception:
<NSInternalInconsistencyException> Error (1002) creating CGSWindow
Executable “event” has exited due to signal 5 (SIGTRAP).
I have no Idea, what causes the abnormal termination. Can anybody
help?
Well, according to the error messages you are getting, there are
autoreleased objects, but you have not created an autorelease pool
for them to go to. So you probably need to set up some autorelease
pool. My guess is that the culprit is the call to NSLocalizedString,
which triggers what looks like a convenience method in NSBundle, and
hence would return an autoreleased NSString object.
Thank you in advance for any hint!
MfG
Michael
Haris
_______________________________________________
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