From 13b8a0571f7164a3b37780833cf9612c665449db Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Mon, 5 Jan 2015 19:57:42 -0500 Subject: [PATCH] Fix segfault at exit --- src/core/hle/service/service.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index c5233e687..61f54d26f 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -50,8 +50,8 @@ Manager::Manager() { } Manager::~Manager() { - for(Interface* service : m_services) { - DeleteService(service->GetPortName()); + for(int i = m_services.size() - 1; i >= 0; --i) { + DeleteService(m_services[i]->GetPortName()); } } @@ -67,7 +67,7 @@ void Manager::DeleteService(const std::string& port_name) { Interface* service = FetchFromPortName(port_name); m_services.erase(std::remove(m_services.begin(), m_services.end(), service), m_services.end()); m_port_map.erase(port_name); - delete service; + Kernel::g_handle_table.Close(service->GetHandle()); } /// Get a Service Interface from its Handle