Re: Native AppKit code hangs my app (NSAppKitImgLock et al)
Re: Native AppKit code hangs my app (NSAppKitImgLock et al)
- Subject: Re: Native AppKit code hangs my app (NSAppKitImgLock et al)
- From: Lorenzo <email@hidden>
- Date: Wed, 02 Mar 2005 22:06:02 +0100
Hi,
I don't use NSAlert to do that. I simply use
NSRunAlertPanel(@"Title:", @"Message", @"OK", @"Cancel", nil);
You can set 3 buttons. Here above I used only 2. Simply replace the nil
value with the string of the 3rd button. The application icon comes
automatically.
You can even get the result of the user's choise with
result = NSRunAlertPanel(@"Title:" .....
result can be NSOKButton, NSCancelButton. I don't remember the value
returned by the 3rd button, but you can easily checked that.
It works all the time like a charm.
Best Regards
--
Lorenzo
email: email@hidden
> From: schneider <email@hidden>
> Date: Wed, 02 Mar 2005 20:20:28 +0100
> To: Lorenzo <email@hidden>
> Subject: Native AppKit code hangs my app (NSAppKitImgLock et al)
>
> Hi
>
> During this, called from readFromFile: in my subclass of NSDocument:
>
>
> NSAlert* alert = [[NSAlert alloc] init] ;
> NSString* text = [NSString stringWithFormat:@"Audio device '%@'
> not found. Some connections will be lost.", [device name]] ;
> [alert setInformativeText: text ] ;
> [alert setIcon: [NSImage imageNamed:@"AppIcon"]] ;
> [alert runModal] ; // App hangs during this runModal call, see
> backtrace below
> [alert release] ;
>
>
> The entire app hangs ca one out of 20 times. Why? It's all
> stuff that is not directly under my command, but the AppKit's (see gdb
> backtrace below). I found
> that it happend less often when using setIcon: .. but still it does not
> go away and occurs sporadically. Exactly the same thing happens from
> time to time while updating a NSTableView. Very strange, looks like a
> bug to me (probably in NSPopUpButtonCell).
>
> Can anybody help? It's very annoying.
> thanks, christian
>
>
> (gdb) backtrace
> #0 0x90016f48 in semaphore_wait_signal_trap ()
> #1 0x9000e790 in _pthread_cond_wait ()
> #2 0x909f1384 in -[NSRecursiveLock lock] ()
> #3 0x92dd1ed8 in _NSAppKitImgLock ()
> #4 0x92df5d9c in GetThemeImage ()
> #5 0x92e60a44 in -[NSPopUpButtonCell
> _drawThemePopUpBorderWithFrame:inView:bordered:style:] ()
> #6 0x92e81820 in -[NSPopUpButtonCell
> drawBorderAndBackgroundWithFrame:inView:] ()
> #7 0x92e6999c in -[NSMenuItemCell drawWithFrame:inView:] ()
> #8 0x92e50b2c in -[NSPopUpButtonCell drawWithFrame:inView:] ()
> #9 0x92df8258 in -[NSControl drawRect:] ()
> #10 0x92dc7c2c in -[NSView _drawRect:clip:] ()
> #11 0x92dd8670 in -[NSView
> _recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
> #12 0x92dc3f44 in -[NSView
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFo
> rView:topView:]
> ()
> #13 0x92dc4360 in -[NSView
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFo
> rView:topView:]
> ()
> #14 0x92dc4360 in -[NSView
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFo
> rView:topView:]
> ()
> #15 0x92e10ef0 in -[NSFrameView
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFo
> rView:topView:]
> ()
> #16 0x92df808c in -[NSThemeFrame
> _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectFo
> rView:topView:]
> ()
> #17 0x92dd5244 in -[NSView
> _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()
> #18 0x92dee274 in -[NSView displayIfNeeded] ()
> #19 0x92dfef4c in -[NSWindow displayIfNeeded] ()
> #20 0x92ddf5ac in _handleWindowNeedsDisplay ()
> #21 0x90191ca0 in __CFRunLoopDoObservers ()
> etc
>
_______________________________________________
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