mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 20:40:11 +02:00
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:
@@ -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) {
|
||||
|
||||
@@ -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&) {}
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user