Implement YaComponentPluginImpl destructor

When the object gets dropped through the reference counting system, the
object should also be dropped in the Wine plugin host.
This commit is contained in:
Robbert van der Helm
2020-12-11 22:59:32 +01:00
parent cdb9dae2df
commit 699ddfd2ea
7 changed files with 51 additions and 6 deletions
+2 -1
View File
@@ -68,7 +68,8 @@ struct WantsPluginFactory {
* encodes the information we request or the operation we want to perform. A
* request of type `ControlRequest(T)` should send back a `T::Response`.
*/
using ControlRequest = std::variant<YaComponent::Create, WantsPluginFactory>;
using ControlRequest =
std::variant<YaComponent::Create, YaComponent::Destroy, WantsPluginFactory>;
template <typename S>
void serialize(S& s, ControlRequest& payload) {
+9
View File
@@ -34,3 +34,12 @@ using Steinberg::TBool, Steinberg::int8, Steinberg::int32, Steinberg::tresult;
using ArrayUID = std::array<
std::remove_reference_t<decltype(std::declval<Steinberg::TUID>()[0])>,
std::extent_v<Steinberg::TUID>>;
/**
* Empty struct for when we have send a response to some operation without any
* result values.
*/
struct Ack {
template <typename S>
void serialize(S&) {}
};
+17 -4
View File
@@ -93,6 +93,22 @@ class YaComponent : public Steinberg::Vst::IComponent {
}
};
/**
* Message to request the Wine plugin host to destroy the IComponent
* instance with the given instance ID. Sent from the destructor of
* `YaComponentPluginImpl`.
*/
struct Destroy {
using Response = Ack;
native_size_t instance_id;
template <typename S>
void serialize(S& s) {
s.value8b(instance_id);
}
};
/**
* Instantiate this instance with arguments read from another interface
* implementation.
@@ -136,11 +152,8 @@ class YaComponent : public Steinberg::Vst::IComponent {
virtual tresult PLUGIN_API
getState(Steinberg::IBStream* state) override = 0;
private:
protected:
CreateArgs arguments;
// TODO: As explained in a few other places, `YaComponent` objects should be
// assigned a unique ID for identification
};
template <typename S>