Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Cocoa/QTKit + Quicktime callbacks == random crashes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa/QTKit + Quicktime callbacks == random crashes?



Did you read all the documentation about QuickTime / QTKit in a multi- threaded environment, like this one http://developer.apple.com/technotes/tn/tn2125.html? This can be really painful and I must admit I have not completely figured it out myself.

But generally, using "performSelectorOnMainThread:" is a very wise thing to do

Alex

On 08.07.2007, at 13:45, Henk Kampman wrote:


My application (see code snippet) sometimes crashes deep in [QTMovie setMovie] when I use 'callBackAtTime', the crash goes away when using 'callBackAtTime | callBackAtInterrupt' and performSelectorOnMainThread.


It looks suspeciously like some weird threading issue.
Does Quicktime call the callback-routine on the mainthread when using 'callBackAtTime'?


I've also found a bug, the callback-routine (CallMeWhen returns noErr) is never called when using 'callBackAtTime | callBackAtDeferredTask'.

-------

void NextMovieCallBack(QTCallBack cb, long refCon)
{
#ifdef RANDOMCRASH
[(MainController*)refCon startNextMovie: nil];
#else
[(NSObject*)refCon performSelectorOnMainThread: @selector(startNextMovie:) withObject: nil waitUntilDone: NO];
#endif
}


-(void) startNextMovie: (id) sender
{
	[self startMovie: [self getNextMovie]];
}

-(void) startMovie: (QTMovie*) movie
{
	if(!callBackProcUPPL) {
		callBackProcUPP = NewQTCallBackUPP(NextMovieCallBack);
	}

	if(movieCallBack) {
		// cancel & dispose the previous callback
		DisposeCallBack(movieCallBack);
		movieCallBack = 0;
	}

if(movie) {
#ifdef RANDOMCRASH
movieCallBack = NewCallBack(GetMovieTimeBase([movie quickTimeMovie]), callBackAtTime);
#else
movieCallBack = NewCallBack(GetMovieTimeBase([movie quickTimeMovie]), callBackAtTime | callBackAtInterrupt);
#endif
CallMeWhen(movieCallBack, callBackProcUPP,(long)self, triggerTimeFwd, 10*[movie duration].timeScale, [movie duration].timeScale);
}

[movieView setMovie: movie]; <-- crashes here
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Cocoa/QTKit + Quicktime callbacks == random crashes? (From: Henk Kampman <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.