Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash in CFRunLoopSourceIsValid



Chris,

I have a problem that looks as it relates to this:

I have a Carbon QuickTime component that connects to an IOKit kext. On open
it calls pthread_create() and from within the new thread it calls
CFRunLoopAddSource() and CFRunLoopRun().

On close I want to kill the thread and call CFRunLoopSourceInvalidate() and
CFRunLoopStop(). The latter sometimes crashes.

What can I do?


This is the code:

CFRunLoopRef gStandardRunLoopRef = nil;
#define kRunLoopCancelled ((CFRunLoopRef)-1)
pthread_mutex_t gStandardRunLoopMutex = PTHREAD_MUTEX_INITIALIZER;

void * MSTStandardCFMRunLoop( void * source)
{
CFRunLoopSourceRef runLoopSource = (CFRunLoopSourceRef)source;

pthread_mutex_lock( &gStandardRunLoopMutex);

if (kRunLoopCancelled != gStandardRunLoopRef) {

gStandardRunLoopRef = CFRunLoopGetCurrent();

CFRunLoopAddSource(
gStandardRunLoopRef,
runLoopSource,
kCFRunLoopDefaultMode);

pthread_mutex_unlock( &gStandardRunLoopMutex);

CFRunLoopRun(); // will block until CFRunLoopStop

} else {
// was already cancelled

pthread_mutex_unlock( &gStandardRunLoopMutex);
}

pthread_detach( pthread_self());
pthread_exit( NULL);

return NULL;
}

void StopStandardRunLoop(
pthread_t runLoopThread,
CFRunLoopSourceRef runLoopSource)
{

pthread_mutex_lock( &gStandardRunLoopMutex);

CFRunLoopRef runLoop = gStandardRunLoopRef;

if (CFRunLoopSourceIsValid (runLoopSource)) {
CFRunLoopSourceInvalidate (runLoopSource);
}

if ((runLoop != nil) && (kRunLoopCancelled != runLoop)) {
CFRunLoopStop( runLoop);
}

gStandardRunLoopRef = kRunLoopCancelled;
// never call CFRunLoopRun again

pthread_mutex_unlock( &gStandardRunLoopMutex);
}


And this is the crash:

Host Name: QS-Panther.local
Date/Time: 2004-05-07 15:07:31 +0200
OS Version: 10.3.2 (Build 7D24)
Report Version: 2

Command: AlchemyTV DVR
Path: /Applications/AlchemyTV DVR/AlchemyTV
DVR.app/Contents/MacOS/AlchemyTV DVR
Version: AlchemyTV DVR version 2.1 (2.1)
PID: 674
Thread: 0

Exception: EXC_BREAKPOINT (0x0006)
Code[0]: 0x00000001
Code[1]: 0x901a10d0


Thread 0 Crashed:
0 com.apple.CoreFoundation 0x901a10d0 CFRunLoopWakeUp + 0x38
1 ComponentO- 0x053f5124 StopStandardRunLoop + 0x74
2 ComponentO- 0x053f1068
CloseIOService__FUiPUiPP12__CFMachPortPP17__CFRunLoopSourcePP17_opaque_pthre
ad_t + 0x88
3 ComponentO- 0x053f11c8 DriverOpen__FPUi + 0xb8
4 ComponentO- 0x053ea158
VampOpen__FP17vdigGlobalsRecordP23ComponentInstanceRecord + 0x78
5 ...ple.CoreServices.CarbonCore 0x90282784
CallComponentFunctionCommon + 0x414
6 CarbonLibpwpc 0x047ba620 0x47b0000 + 0xa620
7 ComponentO- 0x053e9ee8 VampComponentDispatch +
0x68
8 ...ple.CoreServices.CarbonCore 0x902814f0 CallComponent + 0x10c
9 ...ple.CoreServices.CarbonCore 0x90299dec CallComponentOpen + 0x28
10 ...ple.CoreServices.CarbonCore 0x9028b7a0 OpenAComponent + 0x200
11 ...ickTimeComponents.component 0x8b4a6650 _SGVideoSetChannelDevice +
0x190
12 ...ple.CoreServices.CarbonCore 0x90282784
CallComponentFunctionCommon + 0x414
13 ...ickTimeComponents.component 0x8b4a2470 _SGVideoComponentDispatch
+ 0x58
14 ...ple.CoreServices.CarbonCore 0x902814f0 CallComponent + 0x10c
15 <<00000000>> 0x91c19a9c 0 + 0x91c19a9c
16 de.meilenstein.AlchemyTV.DVR 0x0002d4e8
-[MSTSequencegrabber(Testfunktionen) getDeviceList] + 0x1a8
(MSTSequencegrabber.mm:3571)
17 de.meilenstein.AlchemyTV.DVR 0x000736c0
-[MST_TVWindowController(Testfunktionen) getDeviceList] + 0x38
(MST_TVWindowController.mm:1992)
18 de.meilenstein.AlchemyTV.DVR 0x00078984 -[MST_TVRCManipulator
videoSourceList] + 0x38 (MST_TVRCManipulator.mm:497)
19 de.meilenstein.rc_plugin 0x04c9fca8 -[MST_RC_Plugin
videoSourceChanged:input:format:] + 0x44 (MST_RC_Plugin.mm:933)
20 de.meilenstein.AlchemyTV.DVR 0x0007b640 -[MST_TVRCManipulator
setVideoSourceWithSourceID:] + 0x184 (MST_TVRCManipulator.mm:1157)
21 de.meilenstein.AlchemyTV.DVR 0x0006d044 -[MST_TVWindowController
showWindowWithSettings:] + 0x7e4 (MST_TVWindowController.mm:264)
22 de.meilenstein.AlchemyTV.DVR 0x00009608 -[MST_TelevioControler
showTVWindow:] + 0xb8 (MST_TelevioControler.mm:1859)
23 de.meilenstein.AlchemyTV.DVR 0x0003c9fc
-[MST_PrefsWindowController doOK:] + 0x240
(MST_PrefsWindowController.mm:361)
24 <<00000000>> 0x92e77588 0 + 0x92e77588
25 <<00000000>> 0x92e7e30c 0 + 0x92e7e30c
26 <<00000000>> 0x92eb852c 0 + 0x92eb852c
27 <<00000000>> 0x92e58028 0 + 0x92e58028
28 <<00000000>> 0x92ec913c 0 + 0x92ec913c
29 <<00000000>> 0x92e8e374 0 + 0x92e8e374
30 <<00000000>> 0x92e027c4 0 + 0x92e027c4
31 <<00000000>> 0x92df4e98 0 + 0x92df4e98
32 <<00000000>> 0x92dfd2a0 0 + 0x92dfd2a0
33 <<00000000>> 0x92eb95f0 0 + 0x92eb95f0
34 de.meilenstein.AlchemyTV.DVR 0x00049a18 main + 0x28 (main.mm:13)
35 de.meilenstein.AlchemyTV.DVR 0x00002720 _start + 0x188 (crt.c:267)
36 dyld 0x8fe1a700 _dyld_start + 0x64

[...]

PPC Thread State:
srr0: 0x901a10d0 srr1: 0x0002d030 vrsave: 0x00000000
cr: 0x44004448 xer: 0x20000004 lr: 0x901a10b8 ctr: 0x900075c0
r0: 0x10000004 r1: 0xbfffdaa0 r2: 0x00000000 r3: 0x10000003
r4: 0x00000011 r5: 0x00000018 r6: 0x00000000 r7: 0x00000000
r8: 0x00000000 r9: 0x00000000 r10: 0x00000010 r11: 0xa0004308
r12: 0x900075c0 r13: 0x00000000 r14: 0x00000100 r15: 0x00000000
r16: 0xa2de7c2c r17: 0xa2de7c2c r18: 0xa2de7c2c r19: 0xa2df7c2c
r20: 0x00000000 r21: 0x00000000 r22: 0x00000001 r23: 0x000003f0
r24: 0x0593988c r25: 0x00000000 r26: 0x01872aa8 r27: 0x01872ab0
r28: 0x059398a0 r29: 0x065be400 r30: 0x01872ab8 r31: 0x01871a74



> The crash address of 0x00000006 means that your -closeService method is
> passing in a NULL pointer to CFRunLoopSourceIsValid().
>
>
> Chris Kane
> CoreFoundation, Apple
> [...]

Regards

Dirk
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.