Avoid potential UB in loggers using composition

This cast would work fine, but any other fields added to those loggers
would be left uninitialized.
This commit is contained in:
Robbert van der Helm
2020-12-04 18:52:33 +01:00
parent c1e7f53cd0
commit 426231a22b
9 changed files with 76 additions and 22 deletions
+1 -3
View File
@@ -55,9 +55,7 @@ Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback)
// bridge will crash otherwise
plugin(),
host_callback_function(host_callback),
// TODO: This is UB, use composition with `generic_logger` instead
logger(static_cast<Vst2Logger&&>(Logger::create_from_environment(
create_logger_prefix(sockets.base_dir)))) {
logger(generic_logger) {
log_init_message();
// This will block until all sockets have been connected to by the Wine VST