Re: [LAD] Segfault when trying to dereference __midi_event.buffer (c++ newbie question)

From: Fons Adriaensen <fons@email-addr-hidden>
Date: Wed Nov 21 2012 - 14:49:21 EET

On Wed, Nov 21, 2012 at 06:54:03PM +0700, Shani Hadiyanto Pribadi wrote:
 
> jack_midi_event_get(&in_event, midi_buf, event_index);
> if ((*(in_event.buffer) & 0xf0) == 0x90) // Segfault happens here, on
> boolean mask operation
> {
> _note = *(in_event.buffer + 1);
> }

You should test the return value of jack_midi_event_get().
The contents of in_event are valid only if that is zero,
which means there actually was an event to be read.

Ciao,

-- 
FA
A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Wed Nov 21 16:15:03 2012

This archive was generated by hypermail 2.1.8 : Wed Nov 21 2012 - 16:15:03 EET