Forcefully initialize the thread local object

Not sure why the initialization wouldn't work, but apparently in some
cases it doesn't. This will still only be initialized once, hopefully.
This commit is contained in:
Robbert van der Helm
2021-05-16 00:46:25 +02:00
parent fc04e2edcb
commit 9696e96564
+8
View File
@@ -215,6 +215,14 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
thread_local std::optional<Request> persistent_object(
persistent_buffers ? std::make_optional<Request>() : std::nullopt);
// FIXME: In some cases this didn't get initialized for some reason.
// Figure out why.
if constexpr (persistent_buffers) {
if (!persistent_object) {
persistent_object.emplace();
}
}
// Reading, processing, and writing back the response for the requests
// we receive works in the same way regardless of which socket we're
// using