fix deep obscure problem with loading multiple backends on OS X

all backends export a symbol declared as "extern "C" ARDOURBACKEND_API ARDOUR::AudioBackendInfo* descriptor ()".
dlopen'ing the backend apparently pushes the symbol "descriptor" into the single flat global namespace that we use
to be like other unix-like systems. this means that if a backend calls its OWN function named "descriptor", it
is indeterminate which one it will be, since the symbol will refer to the function first loaded by the runtime
linker. If the backend is not the first one discovered, this call to its own "descriptor" function will invoke
the function defined by another backend, even though these are supposed to have local scope only according
to our arguments to dlopen().

This fix doesn't try to fix the linker or namespace - it just makes sure that the WavesAudio backend doesn't
invoke its own descriptor() function, which it never really needed to do anyway.
This commit is contained in:
Paul Davis 2014-09-30 22:56:57 -04:00
parent cd60fd9dfe
commit 3d12a4da82
2 changed files with 4 additions and 4 deletions

View file

@ -97,8 +97,8 @@ void WavesAudioBackend::AudioDeviceManagerNotification (NotificationReason reaso
}
WavesAudioBackend::WavesAudioBackend (AudioEngine& e, AudioBackendInfo& info)
: AudioBackend (e, info)
WavesAudioBackend::WavesAudioBackend (AudioEngine& e)
: AudioBackend (e, __backend_info)
, _audio_device_manager (this)
, _midi_device_manager (*this)
, _device (NULL)
@ -1201,7 +1201,7 @@ WavesAudioBackend::__waves_backend_factory (AudioEngine& e)
{
// COMMENTED DBG LOGS */ std::cout << "WavesAudioBackend::__waves_backend_factory ():" << std::endl;
if (!__instance) {
__instance.reset (new WavesAudioBackend (e, *(descriptor())));
__instance.reset (new WavesAudioBackend (e));
}
return __instance;
}

View file

@ -70,7 +70,7 @@ class WavesMidiPort;
class WavesAudioBackend : public AudioBackend, WCMRAudioDeviceManagerClient
{
public:
WavesAudioBackend (AudioEngine& e, AudioBackendInfo&);
WavesAudioBackend (AudioEngine& e);
virtual ~WavesAudioBackend ();
/* AUDIOBACKEND API */