Allow null pointers in IEditController::setComponentHandler

This commit is contained in:
Robbert van der Helm
2021-01-24 14:51:18 +01:00
parent 0044bc6b60
commit 77414c80d6
4 changed files with 41 additions and 16 deletions
+7 -2
View File
@@ -306,8 +306,13 @@ bool Vst3Logger::log_request(
const YaEditController::SetComponentHandler& request) {
return log_request_base(is_host_vst, [&](auto& message) {
message << request.instance_id
<< ": IEditController::setComponentHandler(handler = "
"<IComponentHandler*>)";
<< ": IEditController::setComponentHandler(handler = ";
if (request.component_handler_proxy_args) {
message << "<IComponentHandler*>";
} else {
message << "<nullptr>";
}
message << ")";
});
}
@@ -344,12 +344,19 @@ class YaEditController : public Steinberg::Vst::IEditController {
native_size_t instance_id;
Vst3ComponentHandlerProxy::ConstructArgs component_handler_proxy_args;
/**
* Some hosts will pass a null pointer to explicitly free the component
* handler passed before releasing the object instance. This also
* happens in the SDK, so this seems like valid behaviour we should
* support.
*/
std::optional<Vst3ComponentHandlerProxy::ConstructArgs>
component_handler_proxy_args;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
s.object(component_handler_proxy_args);
s.ext(component_handler_proxy_args, bitsery::ext::StdOptional{});
}
};