aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-08 18:53:49 -0800
committerChris Robinson <[email protected]>2018-03-08 18:53:49 -0800
commit0c7fa1b955d441a4dc3e87aba8148ed8ade91e2b (patch)
treecfe883a316ee0c4a957e95cbc359036cf46c267a
parentaa7df8183f5acd81ca2d26b057eb89eccbf85492 (diff)
Avoid deinitializing backends that never initialized
-rw-r--r--Alc/ALc.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 554a4951..00c6b6fa 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1075,27 +1075,33 @@ static void alc_initconfig(void)
BackendListSize = i;
}
- for(i = 0;i < BackendListSize && (!PlaybackBackend.name || !CaptureBackend.name);i++)
+ for(n = i = 0;i < BackendListSize && (!PlaybackBackend.name || !CaptureBackend.name);i++)
{
- ALCbackendFactory *factory = BackendList[i].getFactory();
+ ALCbackendFactory *factory;
+ BackendList[n] = BackendList[i];
+
+ factory = BackendList[n].getFactory();
if(!V0(factory,init)())
{
- WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name);
+ WARN("Failed to initialize backend \"%s\"\n", BackendList[n].name);
continue;
}
- TRACE("Initialized backend \"%s\"\n", BackendList[i].name);
+ TRACE("Initialized backend \"%s\"\n", BackendList[n].name);
if(!PlaybackBackend.name && V(factory,querySupport)(ALCbackend_Playback))
{
- PlaybackBackend = BackendList[i];
+ PlaybackBackend = BackendList[n];
TRACE("Added \"%s\" for playback\n", PlaybackBackend.name);
}
if(!CaptureBackend.name && V(factory,querySupport)(ALCbackend_Capture))
{
- CaptureBackend = BackendList[i];
+ CaptureBackend = BackendList[n];
TRACE("Added \"%s\" for capture\n", CaptureBackend.name);
}
+ n++;
}
+ BackendListSize = n;
+
{
ALCbackendFactory *factory = ALCloopbackFactory_getFactory();
V0(factory,init)();