Re: NSProgressIndicator thread crash
Re: NSProgressIndicator thread crash
- Subject: Re: NSProgressIndicator thread crash
- From: Florent Pillet <email@hidden>
- Date: Thu, 24 Feb 2005 10:58:11 +0100
More information on this. I have investigated more on this crash and it
turns out my code had not removed the sheet containing the progress bar
yet. Furthermore, the progress indicator was not in "indeterminate"
mode. I can tell this for sure because I have another thread running
still performing the work that triggers the main thread's progress
indicator update.
So it boils down to this: when the main thread is updating the view,
there is a race condition in the AppKit that makes it so the heartBeat
thread is accessing objects that are being or going to modify objects
in the view. Again, not seeing the AppKit source code makes it hard to
debug.
The crash log shows that both the heartBeat thread and the main thread
are racing to update the view on screen. I assume that both threads
would internally use -[NSViewHierarchyLock lockForWriting] and that
there is a design issue in the way the lock works. Specifically, there
is a race between -[NSViewHierarchyLock lockForWriting] and -[NSView
lockFocusIfCanDraw] when running from two separate threads.
The only way to avoid this mess would be to turn threaded animation
OFF, until the bug is resolved. I've asked the user to send me a
profile report of his computer and am filing a bug in radar about this.
Regards,
Florent
On 24 févr. 05, at 09:23, Florent Pillet wrote:
Today I got a report of a crash in one of my apps. Examining the crash
log the user sent reveals that this is the thread updating the
progress bar that crashed. In my app, I have a sheet that first uses a
normal progress bar, then switches the progress bar to infinite until
the task is complete and the sheet is removed.
I suspect the call to [NSApp endSheet:] may have removed the sheet
while the progress bar thread was still scheduled. I have added a
[progressBar setIndeterminate:NO] just before the endSheet: call, but
I wanted to have expert's advice about this crash.
Here is part of the crash log:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x0000004c
Thread 0:
0 libSystem.B.dylib 0x90016f48
semaphore_wait_signal_trap +
0x8
1 libSystem.B.dylib 0x9000e790 _pthread_cond_wait +
0x270
2 com.apple.AppKit 0x92dca8ec -[NSViewHierarchyLock
lockForWriting] + 0x194
3 com.apple.AppKit 0x92dd51d8 -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] +
0x114
4 com.apple.AppKit 0x92dee274 -[NSView
displayIfNeeded] +
0xa8
5 com.apple.AppKit 0x92dfef4c -[NSWindow
displayIfNeeded] +
0xb4
6 com.apple.AppKit 0x92ddf5ac
_handleWindowNeedsDisplay +
0xe0
7 com.apple.CoreFoundation 0x90191ca0
__CFRunLoopDoObservers + 0x194
8 com.apple.CoreFoundation 0x9019153c __CFRunLoopRun + 0x18c
9 com.apple.CoreFoundation 0x90195e8c CFRunLoopRunSpecific
+ 0x148
10 com.apple.HIToolbox 0x927d5f60
RunCurrentEventLoopInMode +
0xac
11 com.apple.HIToolbox 0x927dc6c8
ReceiveNextEventCommon + 0x17c
12 com.apple.HIToolbox 0x927fe6a0
BlockUntilNextEventMatchingListInMode + 0x60
13 com.apple.AppKit 0x92dd2e44 _DPSNextEvent + 0x180
14 com.apple.AppKit 0x92de98c8 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 0x74
15 com.apple.AppKit 0x92dfdc30 -[NSApplication run]
+ 0x21c
16 OmniAppKit 0x3b207950 -[OAApplication run]
+ 0x94
17 com.apple.AppKit 0x92eba2b8 NSApplicationMain +
0x1d0
18 SyncBuddy 0x0000aa08 0x1000 + 0x9a08
19 dyld 0x8fe1a558 _dyld_start + 0x64
Thread 2 Crashed:
0 com.apple.AppKit 0x92dc50c4 -[NSView
lockFocusIfCanDraw]
+ 0x2a4
1 com.apple.AppKit 0x92de9ea0 -[NSView lockFocus] +
0x28
2 com.apple.AppKit 0x92e21f68 -[NSUIHeartBeat
lockFocusForView:inRect:needsTranslation:] + 0x224
3 com.apple.AppKit 0x92de7954 -[NSProgressIndicator
heartBeat:] + 0x640
4 com.apple.AppKit 0x92dcaf2c -[NSUIHeartBeat
_heartBeatThread:] + 0x3d8
5 com.apple.Foundation 0x90a39b74 forkThreadForFunction
+ 0x6c
6 libSystem.B.dylib 0x900246e8 _pthread_body + 0x28
--
Florent Pillet http://www.florentpillet.com
Freelance software developer/consultant - Palm OS & Mac OS X
ICQ: 117292463 Skype: callto://florent.pillet
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
--
Florent Pillet http://www.florentpillet.com
Freelance software developer/consultant - Palm OS & Mac OS X
ICQ: 117292463 Skype: callto://florent.pillet
_______________________________________________
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