I observed segmentation faults at 'random' moments while using the
crossfader a lot (X-Audio Session Pro) which I was able to traceback to
invalid data being passed a qDebug( ) in the MidiObject::receive( ) routine.

Apparently, for some weird reason, newValue can be invalid -- causing a
crash.

The qDebug( ) is now skipped if !newValue and also the call to
p->queueFromMidi( ) if this is the case, but I am unsure if that's really
OK.

This seems to fix this segfault and, importantly, seems not to break any
other stuff (for me). :)

Cheers,
NG
Index: midiobject.cpp
===================================================================
--- midiobject.cpp	(revision 2738)
+++ midiobject.cpp	(working copy)
@@ -52,10 +52,10 @@
     // Wait for the m_pScriptEngine to initialize
     while(!m_pScriptEngine->isReady()) ;
     m_pScriptEngine->moveToThread(m_pScriptEngine);
+#endif
 
     m_pMidiMapping = new MidiMapping(*this);
 //     m_pMidiMapping->loadInitialPreset();
-#endif
     connect(this, SIGNAL(midiEvent(MidiMessage)), m_pMidiMapping, SLOT(finishMidiLearn(MidiMessage)));
     connect(m_pMidiMapping, SIGNAL(midiLearningStarted()), this, SLOT(enableMidiLearn()));
     connect(m_pMidiMapping, SIGNAL(midiLearningFinished()), this, SLOT(disableMidiLearn()));
@@ -245,8 +245,11 @@
     if (p) //Only pass values on to valid ControlObjects.
     {
       double newValue = m_pMidiMapping->ComputeValue(mixxxControl.getMidiOption(), p->GetMidiValue(), value);
-      qDebug() << "value coming out ComputeValue: " << newValue;
+	
+      if (newValue)
+          qDebug() << "value coming out ComputeValue: " << newValue;
 
+
       // ControlPushButton ControlObjects only accept NOTE_ON, so if the midi mapping is <button> we override the Midi 'status' appropriately.
       switch (mixxxControl.getMidiOption()) {
               case MIDI_OPT_BUTTON:
@@ -255,7 +258,8 @@
 
       ControlObject::sync();
 
-      p->queueFromMidi(status, newValue);
+      if (newValue)
+          p->queueFromMidi(status, newValue);
     }
 
     return;
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to