mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-26 13:16:58 +00:00
Merge pull request #4689 from wwylele/server-leak
ServiceFrameworkBase: remove ownership to ServerPort
This commit is contained in:
commit
c1de8acfe5
|
@ -293,7 +293,6 @@ void System::Shutdown() {
|
||||||
// Shutdown emulation session
|
// Shutdown emulation session
|
||||||
GDBStub::Shutdown();
|
GDBStub::Shutdown();
|
||||||
VideoCore::Shutdown();
|
VideoCore::Shutdown();
|
||||||
kernel.reset();
|
|
||||||
HW::Shutdown();
|
HW::Shutdown();
|
||||||
telemetry_session.reset();
|
telemetry_session.reset();
|
||||||
rpc_server.reset();
|
rpc_server.reset();
|
||||||
|
@ -301,6 +300,7 @@ void System::Shutdown() {
|
||||||
service_manager.reset();
|
service_manager.reset();
|
||||||
dsp_core.reset();
|
dsp_core.reset();
|
||||||
cpu_core.reset();
|
cpu_core.reset();
|
||||||
|
kernel.reset();
|
||||||
timing.reset();
|
timing.reset();
|
||||||
app_loader.reset();
|
app_loader.reset();
|
||||||
|
|
||||||
|
|
|
@ -131,13 +131,11 @@ ServiceFrameworkBase::ServiceFrameworkBase(const char* service_name, u32 max_ses
|
||||||
ServiceFrameworkBase::~ServiceFrameworkBase() = default;
|
ServiceFrameworkBase::~ServiceFrameworkBase() = default;
|
||||||
|
|
||||||
void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager) {
|
void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager) {
|
||||||
ASSERT(port == nullptr);
|
auto port = service_manager.RegisterService(service_name, max_sessions).Unwrap();
|
||||||
port = service_manager.RegisterService(service_name, max_sessions).Unwrap();
|
|
||||||
port->SetHleHandler(shared_from_this());
|
port->SetHleHandler(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) {
|
void ServiceFrameworkBase::InstallAsNamedPort(Kernel::KernelSystem& kernel) {
|
||||||
ASSERT(port == nullptr);
|
|
||||||
auto [server_port, client_port] = kernel.CreatePortPair(max_sessions, service_name);
|
auto [server_port, client_port] = kernel.CreatePortPair(max_sessions, service_name);
|
||||||
server_port->SetHleHandler(shared_from_this());
|
server_port->SetHleHandler(shared_from_this());
|
||||||
kernel.AddNamedPort(service_name, std::move(client_port));
|
kernel.AddNamedPort(service_name, std::move(client_port));
|
||||||
|
|
|
@ -92,12 +92,6 @@ private:
|
||||||
/// Maximum number of concurrent sessions that this service can handle.
|
/// Maximum number of concurrent sessions that this service can handle.
|
||||||
u32 max_sessions;
|
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.
|
/// Function used to safely up-cast pointers to the derived class before invoking a handler.
|
||||||
InvokerFn* handler_invoker;
|
InvokerFn* handler_invoker;
|
||||||
boost::container::flat_map<u32, FunctionInfoBase> handlers;
|
boost::container::flat_map<u32, FunctionInfoBase> handlers;
|
||||||
|
|
Loading…
Reference in a new issue