Store the actual context menu proxy impls

This commit is contained in:
Robbert van der Helm
2021-01-06 23:59:05 +01:00
parent 48787b5e60
commit 26eb8ac1f3
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -22,6 +22,7 @@
#include "vst3-impls/component-handler-proxy.h"
#include "vst3-impls/connection-point-proxy.h"
#include "vst3-impls/context-menu-proxy.h"
#include "vst3-impls/host-context-proxy.h"
#include "vst3-impls/plug-frame-proxy.h"
@@ -858,14 +859,14 @@ void Vst3Bridge::handle_win32_events() {
}
}
void Vst3Bridge::register_context_menu(Vst3ContextMenuProxy& context_menu) {
void Vst3Bridge::register_context_menu(Vst3ContextMenuProxyImpl& context_menu) {
std::lock_guard lock(object_instances[context_menu.owner_instance_id()]
.registered_context_menus_mutex);
object_instances[context_menu.owner_instance_id()]
.registered_context_menus.emplace(
context_menu.context_menu_id(),
std::ref<Vst3ContextMenuProxy>(context_menu));
std::ref<Vst3ContextMenuProxyImpl>(context_menu));
}
void Vst3Bridge::unregister_context_menu(size_t object_instance_id,
+5 -2
View File
@@ -26,6 +26,9 @@
#include "../editor.h"
#include "common.h"
// Forward declarations
class Vst3ContextMenuProxyImpl;
/**
* A holder for an object instance's `IPlugView` object and all smart pointers
* casted from it.
@@ -114,7 +117,7 @@ struct InstanceInterfaces {
* @relates Vst3Bridge::register_context_menu
* @relates Vst3Bridge::unregister_context_menu
*/
std::map<size_t, std::reference_wrapper<Vst3ContextMenuProxy>>
std::map<size_t, std::reference_wrapper<Vst3ContextMenuProxyImpl>>
registered_context_menus;
std::mutex registered_context_menus_mutex;
@@ -310,7 +313,7 @@ class Vst3Bridge : public HostBridge {
* `object_instances`. This will be called during the constructor of
* `Vst3ContextMenuProxyImpl` so we can refer to the exact instance later.
*/
void register_context_menu(Vst3ContextMenuProxy& context_menu);
void register_context_menu(Vst3ContextMenuProxyImpl& context_menu);
/**
* Remove a previously registered context menu from `object_instances`. This