mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Ensure all kernel objects are released during shutdown
This commit fixes several kernel object leaks. The most severe of them was threads not being removed from the private handle table used for CoreTiming events. This resulted in Threads never being released, which in turn held references to Process, causing CodeSets to never be freed when loading other applications.
This commit is contained in:
		
							parent
							
								
									078bf29d1d
								
							
						
					
					
						commit
						dc39d06950
					
				
					 12 changed files with 45 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -406,6 +406,9 @@ void Shutdown() {
 | 
			
		|||
    lock = nullptr;
 | 
			
		||||
    notification_event = nullptr;
 | 
			
		||||
    parameter_event = nullptr;
 | 
			
		||||
 | 
			
		||||
    next_parameter.object = nullptr;
 | 
			
		||||
 | 
			
		||||
    HLE::Applets::Shutdown();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -310,4 +310,9 @@ Interface::Interface() {
 | 
			
		|||
    Register(FunctionTable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Interface::~Interface() {
 | 
			
		||||
    semaphore_event = nullptr;
 | 
			
		||||
    interrupt_event = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@ namespace DSP_DSP {
 | 
			
		|||
class Interface : public Service::Interface {
 | 
			
		||||
public:
 | 
			
		||||
    Interface();
 | 
			
		||||
    ~Interface() override;
 | 
			
		||||
 | 
			
		||||
    std::string GetPortName() const override {
 | 
			
		||||
        return "dsp::DSP";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -584,7 +584,7 @@ const Interface::FunctionInfo FunctionTable[] = {
 | 
			
		|||
Interface::Interface() {
 | 
			
		||||
    Register(FunctionTable);
 | 
			
		||||
 | 
			
		||||
    g_interrupt_event = 0;
 | 
			
		||||
    g_interrupt_event = nullptr;
 | 
			
		||||
 | 
			
		||||
    using Kernel::MemoryPermission;
 | 
			
		||||
    g_shared_memory = Kernel::SharedMemory::Create(0x1000, MemoryPermission::ReadWrite,
 | 
			
		||||
| 
						 | 
				
			
			@ -593,4 +593,9 @@ Interface::Interface() {
 | 
			
		|||
    g_thread_id = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Interface::~Interface() {
 | 
			
		||||
    g_interrupt_event = nullptr;
 | 
			
		||||
    g_shared_memory = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,6 +161,7 @@ static_assert(sizeof(CommandBuffer) == 0x200, "CommandBuffer struct has incorrec
 | 
			
		|||
class Interface : public Service::Interface {
 | 
			
		||||
public:
 | 
			
		||||
    Interface();
 | 
			
		||||
    ~Interface() override;
 | 
			
		||||
 | 
			
		||||
    std::string GetPortName() const override {
 | 
			
		||||
        return "gsp::Gpu";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,4 +125,8 @@ Interface::Interface() {
 | 
			
		|||
    Register(FunctionTable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Interface::~Interface() {
 | 
			
		||||
    handle_event = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@ namespace NWM_UDS {
 | 
			
		|||
class Interface : public Service::Interface {
 | 
			
		||||
public:
 | 
			
		||||
    Interface();
 | 
			
		||||
    ~Interface() override;
 | 
			
		||||
 | 
			
		||||
    std::string GetPortName() const override {
 | 
			
		||||
        return "nwm::UDS";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,4 +68,8 @@ Interface::Interface() {
 | 
			
		|||
    Register(FunctionTable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Interface::~Interface() {
 | 
			
		||||
    event_handle = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,7 @@ namespace SRV {
 | 
			
		|||
class Interface : public Service::Interface {
 | 
			
		||||
public:
 | 
			
		||||
    Interface();
 | 
			
		||||
    ~Interface() override;
 | 
			
		||||
 | 
			
		||||
    std::string GetPortName() const override {
 | 
			
		||||
        return "srv:";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -410,4 +410,8 @@ Interface::Interface() {
 | 
			
		|||
    Register(FunctionTable);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Interface::~Interface() {
 | 
			
		||||
    completion_event = nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,6 +112,7 @@ struct ConversionConfiguration {
 | 
			
		|||
class Interface : public Service::Interface {
 | 
			
		||||
public:
 | 
			
		||||
    Interface();
 | 
			
		||||
    ~Interface() override;
 | 
			
		||||
 | 
			
		||||
    std::string GetPortName() const override {
 | 
			
		||||
        return "y2r:u";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue