Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when MIDI events are received after an MIKMIDIConnectionManager has been created then deallocated. #215

Closed
armadsen opened this issue Nov 28, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@armadsen
Copy link
Member

Reported in Issue #214. To reproduce, create a new, empty project with the following:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
	_ = MIKMIDIConnectionManager(name: "test")
	return true
}

Run the app with a MIDI device already connected. After the app launches, press a button on the MIDI device and watch the app crash here:

- (BOOL)internalConnectToDevice:(MIKMIDIDevice *)device error:(NSError **)error
{
	if ([self isConnectedToDevice:device]) return YES;
	error = error ?: &(NSError *__autoreleasing){ nil };
	
	__weak typeof(self) weakSelf = self;
	id token = [self.deviceManager connectDevice:device error:error eventHandler:^(MIKMIDISourceEndpoint *endpoint, NSArray *commands) {
		[weakSelf recordPendingNoteOnCommands:commands fromDevice:device];
		[weakSelf removePendingNoteOnCommandsTerminatedByNoteOffCommands:commands fromDevice:device];
		
		weakSelf.eventHandler(endpoint, commands); // *** CRASH ***
	}];

<snip>

}
@armadsen armadsen added the bug label Nov 28, 2017
@armadsen armadsen added this to the 1.6.3 milestone Nov 28, 2017
@armadsen armadsen self-assigned this Nov 28, 2017
armadsen added a commit that referenced this issue Nov 28, 2017
@armadsen armadsen modified the milestones: 1.6.3, 1.7 Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant