diff options
| author | 2018-12-12 20:07:14 +0100 | |
|---|---|---|
| committer | 2018-12-13 20:08:23 +0100 | |
| commit | 27a9cc2e63d07989fdb4efeeb6a6b3417281f177 (patch) | |
| tree | 7df6d4eadc9af7b42e467576dbf16528664f8a9e /src/core/hle/service/service.h | |
| parent | Merge pull request #1890 from jschmer/master (diff) | |
| download | yuzu-27a9cc2e63d07989fdb4efeeb6a6b3417281f177.tar.gz yuzu-27a9cc2e63d07989fdb4efeeb6a6b3417281f177.tar.xz yuzu-27a9cc2e63d07989fdb4efeeb6a6b3417281f177.zip | |
Fix Service object leak on emulation stop
Services created with the ServiceFramework base class install themselves as HleHandlers with an owning shared_ptr in the ServerPort ServiceFrameworkBase::port member variable, creating a cyclic ownership between ServiceFrameworkBase and the ServerPort, preventing deletion of the service objects.
Fix that by removing the ServiceFrameworkBase::port member because that was only used to detect multiple attempts at installing a port. Instead store a flag if the port was already installed to achieve the same functionality.
Diffstat (limited to 'src/core/hle/service/service.h')
| -rw-r--r-- | src/core/hle/service/service.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 98483ecf1..029533628 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -96,11 +96,9 @@ private: | |||
| 96 | /// Maximum number of concurrent sessions that this service can handle. | 96 | /// Maximum number of concurrent sessions that this service can handle. |
| 97 | u32 max_sessions; | 97 | u32 max_sessions; |
| 98 | 98 | ||
| 99 | /** | 99 | /// Flag to store if a port was already create/installed to detect multiple install attempts, |
| 100 | * Port where incoming connections will be received. Only created when InstallAsService() or | 100 | /// which is not supported. |
| 101 | * InstallAsNamedPort() are called. | 101 | bool port_installed = false; |
| 102 | */ | ||
| 103 | Kernel::SharedPtr<Kernel::ServerPort> port; | ||
| 104 | 102 | ||
| 105 | /// Function used to safely up-cast pointers to the derived class before invoking a handler. | 103 | /// Function used to safely up-cast pointers to the derived class before invoking a handler. |
| 106 | InvokerFn* handler_invoker; | 104 | InvokerFn* handler_invoker; |