aboutsummaryrefslogtreecommitdiffstats
path: root/testing/portmidi/11-pmlinuxalsa.patch
diff options
context:
space:
mode:
authorTaner Tas <taner76@gmail.com>2018-02-21 16:33:34 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2018-02-28 12:53:05 +0000
commit24cdbb59afb3e0141401a09cc98c918283ccdc49 (patch)
treec18c934ec904845e8c95d4f52137960751faeec0 /testing/portmidi/11-pmlinuxalsa.patch
parent478a4a468ecf31c263b6c76dfab0f2332bc3365f (diff)
downloadaports-24cdbb59afb3e0141401a09cc98c918283ccdc49.tar.bz2
aports-24cdbb59afb3e0141401a09cc98c918283ccdc49.tar.xz
testing/portmidi: new aport
http://portmedia.sourceforge.net/ PortMidi is a platform independent library for MIDI input/output.
Diffstat (limited to 'testing/portmidi/11-pmlinuxalsa.patch')
-rw-r--r--testing/portmidi/11-pmlinuxalsa.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/testing/portmidi/11-pmlinuxalsa.patch b/testing/portmidi/11-pmlinuxalsa.patch
new file mode 100644
index 0000000000..eb98a79df0
--- /dev/null
+++ b/testing/portmidi/11-pmlinuxalsa.patch
@@ -0,0 +1,70 @@
+Subject: Prevent SIGSEGV on handling events for already closed devices.
+Bug: http://sourceforge.net/apps/trac/portmedia/ticket/3
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695842
+Bug-Ubuntu: https://launchpad.net/bugs/1073484
+Applied-Upstream: yes
+---
+ pm_linux/pmlinuxalsa.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- portmidi-200.orig/pm_linux/pmlinuxalsa.c
++++ portmidi-200/pm_linux/pmlinuxalsa.c
+@@ -193,6 +193,7 @@ static PmError alsa_write_byte(PmInterna
+ snd_seq_event_t ev;
+ int err;
+
++ if (!desc) return pmBadPtr;
+ snd_seq_ev_clear(&ev);
+ if (snd_midi_event_encode_byte(desc->parser, byte, &ev) == 1) {
+ snd_seq_ev_set_dest(&ev, desc->client, desc->port);
+@@ -339,6 +340,7 @@ static PmError alsa_in_close(PmInternal
+ pm_hosterror = snd_seq_delete_port(seq, desc->this_port);
+ }
+ alsa_unuse_queue();
++ midi->descriptor = NULL;
+ pm_free(desc);
+ if (pm_hosterror) {
+ get_alsa_error_text(pm_hosterror_text, PM_HOST_ERROR_MSG_LEN,
+@@ -433,6 +435,7 @@ static PmError alsa_write(PmInternal *mi
+ static PmError alsa_write_flush(PmInternal *midi, PmTimestamp timestamp)
+ {
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return pmBadPtr;
+ VERBOSE printf("snd_seq_drain_output: 0x%x\n", (unsigned int) seq);
+ desc->error = snd_seq_drain_output(seq);
+ if (desc->error < 0) return pmHostError;
+@@ -448,6 +451,7 @@ static PmError alsa_write_short(PmIntern
+ PmMessage msg = event->message;
+ int i;
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return pmBadPtr;
+ for (i = 0; i < bytes; i++) {
+ unsigned char byte = msg;
+ VERBOSE printf("sending 0x%x\n", byte);
+@@ -481,6 +485,10 @@ static void handle_event(snd_seq_event_t
+ {
+ int device_id = ev->dest.port;
+ PmInternal *midi = descriptors[device_id].internalDescriptor;
++ /* The device we received events for might have been closed before we
++ processed them. */
++ if (!midi)
++ return;
+ PmEvent pm_ev;
+ PmTimeProcPtr time_proc = midi->time_proc;
+ PmTimestamp timestamp;
+@@ -650,6 +658,7 @@ static PmError alsa_poll(PmInternal *mid
+ static unsigned int alsa_has_host_error(PmInternal *midi)
+ {
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return 0;
+ return desc->error;
+ }
+
+@@ -657,6 +666,7 @@ static unsigned int alsa_has_host_error(
+ static void alsa_get_host_error(PmInternal *midi, char *msg, unsigned int len)
+ {
+ alsa_descriptor_type desc = (alsa_descriptor_type) midi->descriptor;
++ if (!desc) return;
+ int err = (pm_hosterror || desc->error);
+ get_alsa_error_text(msg, len, err);
+ }