[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/kmid/alsa
From: Pedro Lopez-Cabanillas <pedro.lopez.cabanillas () gmail ! com>
Date: 2010-06-06 18:54:44
Message-ID: 20100606190136.BCC32AC8CC () svn ! kde ! org
[Download RAW message or body]
SVN commit 1135192 by pedrol:
ALSAMIDIOutput::sendEvent() is called from two different threads. To avoid problems, \
this method needs to be protected by a mutex. It may be one of the causes of the \
crashes detected in a quad core system, but I couldn't reproduce it.
CCBUG: 240391
M +10 -5 alsamidioutput.cpp
--- trunk/extragear/multimedia/kmid/alsa/alsamidioutput.cpp #1135191:1135192
@@ -27,6 +27,7 @@
#include <QString>
#include <QStringList>
+#include <QMutex>
using namespace drumstick;
@@ -72,6 +73,7 @@
bool m_muted[MIDI_CHANNELS];
bool m_locked[MIDI_CHANNELS];
QByteArray m_resetMessage;
+ QMutex m_outMutex;
void transformControllerEvent(SequencerEvent *ev)
{
@@ -364,20 +366,23 @@
void ALSAMIDIOutput::sendEvent(SequencerEvent *ev)
{
+ d->m_outMutex.lock();
d->transformEvent(ev);
+ bool discard(false);
if (SequencerEvent::isChannel(ev)) {
ChannelEvent *cev = static_cast<ChannelEvent*>(ev);
- if ( d->m_muted[ cev->getChannel() ] )
- return;
- if ( (cev->getSequencerType() == SND_SEQ_EVENT_PGMCHANGE) &&
- d->m_locked[ cev->getChannel() ] )
- return;
+ discard = d->m_muted[ cev->getChannel() ] |
+ ( (cev->getSequencerType() == SND_SEQ_EVENT_PGMCHANGE)
+ && d->m_locked[ cev->getChannel() ] );
}
+ if (!discard) {
ev->setSource(d->m_portId);
ev->setSubscribers();
ev->setDirect();
d->m_client->outputDirect(ev);
}
+ d->m_outMutex.unlock();
+ }
void ALSAMIDIOutput::sendNoteOn(int chan, int note, int vel)
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic