Hello,

Attached is a patch that fixes a NULL pointer dereference problem that
occurs when LinuxSampler is restored as an LV2 in Ardour 3.0.

This problem does not occur in at least one other host, qsampler, and I
am not sure why.  Perhaps because the plugin has not been activated yet?
The persist extension does not specify anything about this yet, opinions
welcome.

This is admittedly a fix based on shallow understanding, a regular LS
dev might have a better idea if this will cause any problems.  It does
fix the crash, anyway.

Peace,

-dr
Index: src/engines/gig/InstrumentResourceManager.cpp
===================================================================
--- src/engines/gig/InstrumentResourceManager.cpp	(revision 2277)
+++ src/engines/gig/InstrumentResourceManager.cpp	(working copy)
@@ -604,8 +604,8 @@
 
         // (try to resolve the audio device context)
         EngineChannel* pEngineChannel = dynamic_cast<EngineChannel*>(pConsumer);
-        AudioOutputDevice* pDevice = 
-            (pEngineChannel) ? dynamic_cast<Engine*>(pEngineChannel->GetEngine())->pAudioOutputDevice : NULL;
+        Engine* pEngine = dynamic_cast<Engine*>(pEngineChannel->GetEngine());
+        AudioOutputDevice* pDevice = (pEngine) ? pEngine->pAudioOutputDevice : NULL;
         
         // and we save this to check if we need to reallocate for a engine with higher value of 'MaxSamplesPerSecond'
         pEntry->MaxSamplesPerCycle =
@@ -628,8 +628,8 @@
         
         // (try to resolve the audio device context)
         EngineChannel* pEngineChannel = dynamic_cast<EngineChannel*>(pConsumer);
-        AudioOutputDevice* pDevice = 
-            (pEngineChannel) ? dynamic_cast<Engine*>(pEngineChannel->GetEngine())->pAudioOutputDevice : NULL;
+        Engine* pEngine = dynamic_cast<Engine*>(pEngineChannel->GetEngine());
+        AudioOutputDevice* pDevice = (pEngine) ? pEngine->pAudioOutputDevice : NULL;
         
         uint maxSamplesPerCycle =
             (pDevice) ? pDevice->MaxSamplesPerCycle() : DefaultMaxSamplesPerCycle();
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Ciosco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to