Another attempt to fix the "Destination array was not long enough" errors in AddToGUIUpdateList:

The errors seem to be caused by adding messages to the debug console from another thread, which may happen if an OpenAL error occurs during sound streaming. Now the debug console queues the messages and creates the necessary UI elements in the main thread, which should(?) make it thread-safe. (TODO: figure out what's causing the OpenAL errors)
This commit is contained in:
Joonas Rikkonen
2017-07-03 19:07:54 +03:00
parent 0d7851367b
commit 8aa6ba71b6
3 changed files with 55 additions and 38 deletions
@@ -51,10 +51,9 @@ namespace Barotrauma.Sounds
if ((error = AL.GetError()) != ALError.NoError)
{
#if DEBUG
DebugConsole.ThrowError("OpenAL error: " + AL.GetErrorString(error));
DebugConsole.ThrowError("OpenAL error: " + AL.GetErrorString(error) + "\n" + Environment.StackTrace);
#else
DebugConsole.NewMessage("OpenAL error: " + AL.GetErrorString(error), Microsoft.Xna.Framework.Color.Red);
DebugConsole.NewMessage("OpenAL error: " + AL.GetErrorString(error) + "\n" + Environment.StackTrace, Microsoft.Xna.Framework.Color.Red);
#endif
}
}