Re: MusicSequenceSetUserCallback - GC error
Re: MusicSequenceSetUserCallback - GC error
- Subject: Re: MusicSequenceSetUserCallback - GC error
- From: Aran Mulholland <email@hidden>
- Date: Sun, 06 Nov 2011 14:24:26 +1100
Are you sure you should be releasing the client data in the callback?
On Sun, Nov 6, 2011 at 9:07 AM, GW Rodriguez
<email@hidden> wrote:
I have an application running with GC required, that has 2 main classes: the delegate class and a class that manages all the MusicPlayer functionality. In the MusicPlayer class I have a method to set the callback:
-(void) setCallback: (MusicSequenceUserCallback) callback {
OSStatus err = MusicSequenceSetUserCallback(seq, callback, [[NSApplication sharedapplication] delegate]);
assert(err == noErr);
}
My custom callback function is in the delegate class so I set the callback with this method above. Every time I start the music player I get this error:
malloc: *** auto malloc[3564]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug.
The program does everything that I want it to do, but I get that error. When I change the MusicSequenceSetUserCallback's 3 argument to nil I still get the error but my code doesn't work.
I guess my main question is: what does the third argument (void* inClientData) really want to be when you want to pass a class? My callback looks something like this:
static void cBackAutomation (void *inClientData, MusicSequence inSequence, MusicTrack inTrack, MusicTimeStamp inEventTime, const MusicEventUserData *inEventData, MusicTimeStamp inStartSliceBeat, MusicTimeStamp inEndSliceBeat) {
Float64 x = inEventTime*25;
MyDelegateClass *mainClass = inClientData;
Float64 y = [mainClass yValueAt:x];
y *= 2;
NSLog(@"*** y value: %.2f", y);
[mainClass release];
};
--
GW Rodriguez
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-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.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden