ServiceFrameworkBase: remove ownership to ServerPort
This causes a reference cycle because ServerPort also holds a shared pointer to SessionRequestHandler (inherited by ServiceFrameworkBase). Given that the member port is never used in ServiceFrameworkBase, we can simply remove it. The port object is kept alive by ServiceManager|KernelSystem::named_ports -> ClientPort -> ServerPort
This commit is contained in:
parent
54d2f16c22
commit
8750b81ce0
@ -131,13 +131,11 @@ ServiceFrameworkBase::ServiceFrameworkBase(const char* service_name, u32 max_ses
|
||||
ServiceFrameworkBase::~ServiceFrameworkBase() = default;
|
||||
|
||||
void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager) {
|
||||
ASSERT(port == nullptr);
|
||||
port = service_manager.RegisterService(service_name, max_sessions).Unwrap();
|
||||
auto port = service_manager.RegisterService(service_name, max_sessions).Unwrap();
|
||||
port->SetHleHandler(shared_from_this());
|
||||
}
|
||||
|
||||
void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) {
|
||||
ASSERT(port == nullptr);
|
||||
auto [server_port, client_port] = kernel.CreatePortPair(max_sessions, service_name);
|
||||
server_port->SetHleHandler(shared_from_this());
|
||||
kernel.AddNamedPort(service_name, std::move(client_port));
|
||||
|
@ -92,12 +92,6 @@ private:
|
||||
/// Maximum number of concurrent sessions that this service can handle.
|
||||
u32 max_sessions;
|
||||
|
||||
/**
|
||||
* Port where incoming connections will be received. Only created when InstallAsService() or
|
||||
* InstallAsNamedPort() are called.
|
||||
*/
|
||||
Kernel::SharedPtr<Kernel::ServerPort> port;
|
||||
|
||||
/// Function used to safely up-cast pointers to the derived class before invoking a handler.
|
||||
InvokerFn* handler_invoker;
|
||||
boost::container::flat_map<u32, FunctionInfoBase> handlers;
|
||||
|
Loading…
Reference in New Issue
Block a user