Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::ContractSessionRegistry Class Reference

The contract sessions one adapter instance opened that a host still holds. More...

#include <contract_editor_session.hpp>

Public Member Functions

 ContractSessionRegistry ()=default
 ~ContractSessionRegistry ()
 ContractSessionRegistry (const ContractSessionRegistry &)=delete
ContractSessionRegistry & operator= (const ContractSessionRegistry &)=delete
void close_all ()
 Close every live registered session for its owner and forget them: at once on the main thread, posted to it from any other thread.
std::size_t size () const
 Registered sessions still alive.

Friends

class ContractEditorSession

Detailed Description

The contract sessions one adapter instance opened that a host still holds.

A host may keep an editor (a VST3 view, an AU Cocoa view) after the plug-in instance that made it is torn down, but the editor's factory belongs to the processor. An adapter whose editors outlive it in that way declares one of these after its processor, so its destruction (or an explicit close_all()) closes every registered session while the processor and store still exist. The host still holds those windows, so each editor is closed in order (gestures released, detached, destroyed), never invalidated.

A host may dispose of the instance off the main thread. Waiting for the main thread there could deadlock a host whose main thread is waiting for that worker, so the registry does not wait: it releases every gesture and cuts each session's port from the store at once (both safe from any thread), then posts the close to the main thread, holding the sessions alive until it runs. By then the processor is gone; an editor reaches the plug-in only through its context, which refuses everything after the cut.

Sessions are held weakly: a session the host has already closed and destroyed is simply skipped, so nothing needs to unregister.

Constructor & Destructor Documentation

◆ ContractSessionRegistry() [1/2]

pulp::format::ContractSessionRegistry::ContractSessionRegistry ( )
default

◆ ~ContractSessionRegistry()

pulp::format::ContractSessionRegistry::~ContractSessionRegistry ( )

◆ ContractSessionRegistry() [2/2]

pulp::format::ContractSessionRegistry::ContractSessionRegistry ( const ContractSessionRegistry & )
delete

Member Function Documentation

◆ close_all()

void pulp::format::ContractSessionRegistry::close_all ( )

Close every live registered session for its owner and forget them: at once on the main thread, posted to it from any other thread.

◆ operator=()

ContractSessionRegistry & pulp::format::ContractSessionRegistry::operator= ( const ContractSessionRegistry & )
delete

◆ size()

std::size_t pulp::format::ContractSessionRegistry::size ( ) const

Registered sessions still alive.

◆ ContractEditorSession

friend class ContractEditorSession
friend

The documentation for this class was generated from the following file: