mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
[Summary] Fixed crash on MAC when MIDI device name is 0 ref
This commit is contained in:
parent
85b4577d7a
commit
3f5bf264c3
1 changed files with 20 additions and 9 deletions
|
|
@ -866,10 +866,14 @@ char* cm_get_full_endpoint_name(MIDIEndpointRef endpoint)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* copy the string into our buffer */
|
/* copy the string into our buffer */
|
||||||
newName = (char *) malloc(CFStringGetLength(fullName) + 1);
|
if (fullName) {
|
||||||
CFStringGetCString(fullName, newName, CFStringGetLength(fullName) + 1,
|
newName = (char *) malloc(CFStringGetLength(fullName) + 1);
|
||||||
defaultEncoding);
|
CFStringGetCString(fullName, newName, CFStringGetLength(fullName) + 1,
|
||||||
|
defaultEncoding);
|
||||||
|
} else {
|
||||||
|
newName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
#ifdef OLDCODE
|
#ifdef OLDCODE
|
||||||
if (endpointName) CFRelease(endpointName);
|
if (endpointName) CFRelease(endpointName);
|
||||||
|
|
@ -972,8 +976,12 @@ PmError pm_macosxcm_init(void)
|
||||||
pm_default_input_device_id = pm_descriptor_index;
|
pm_default_input_device_id = pm_descriptor_index;
|
||||||
|
|
||||||
/* Register this device with PortMidi */
|
/* Register this device with PortMidi */
|
||||||
pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint),
|
char* full_endpoint_name = cm_get_full_endpoint_name(endpoint);
|
||||||
TRUE, (void *) (long) endpoint, &pm_macosx_in_dictionary);
|
if (full_endpoint_name != NULL) {
|
||||||
|
pm_add_device("CoreMIDI", full_endpoint_name,
|
||||||
|
TRUE, (void *) (long) endpoint, &pm_macosx_in_dictionary);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Iterate over the MIDI output devices */
|
/* Iterate over the MIDI output devices */
|
||||||
|
|
@ -988,9 +996,12 @@ PmError pm_macosxcm_init(void)
|
||||||
pm_default_output_device_id = pm_descriptor_index;
|
pm_default_output_device_id = pm_descriptor_index;
|
||||||
|
|
||||||
/* Register this device with PortMidi */
|
/* Register this device with PortMidi */
|
||||||
pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint),
|
char* full_endpoint_name = cm_get_full_endpoint_name(endpoint);
|
||||||
FALSE, (void *) (long) endpoint,
|
if (full_endpoint_name != NULL) {
|
||||||
&pm_macosx_out_dictionary);
|
pm_add_device("CoreMIDI", full_endpoint_name,
|
||||||
|
FALSE, (void *) (long) endpoint,
|
||||||
|
&pm_macosx_out_dictionary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return pmNoError;
|
return pmNoError;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue