Service: release shared memory object when finalize

Since last commit SharedMemory only reset source memory set on dtor, service should always release the ref as soon as possible to make the reset happen
This commit is contained in:
Weiyi Wang 2018-11-10 11:27:15 -05:00
parent cfa9a322c7
commit d90094e8a7
4 changed files with 21 additions and 1 deletions

View File

@ -136,6 +136,7 @@ void SoftwareKeyboard::Finalize() {
SendParameter(message);
is_running = false;
text_memory = nullptr;
}
Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(

View File

@ -443,6 +443,17 @@ void HTTP_C::CloseClientCertContext(Kernel::HLERequestContext& ctx) {
LOG_DEBUG(Service_HTTP, "called, cert_handle={}", cert_handle);
}
void HTTP_C::Finalize(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x39, 0, 0);
shared_memory = nullptr;
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_HTTP, "(STUBBED) called");
}
void HTTP_C::DecryptClCertA() {
static constexpr u32 iv_length = 16;
@ -575,7 +586,7 @@ HTTP_C::HTTP_C() : ServiceFramework("http:C", 32) {
{0x00360000, nullptr, "ClearDNSCache"},
{0x00370080, nullptr, "SetKeepAlive"},
{0x003800C0, nullptr, "SetPostDataTypeSize"},
{0x00390000, nullptr, "Finalize"},
{0x00390000, &HTTP_C::Finalize, "Finalize"},
};
RegisterHandlers(functions);

View File

@ -240,6 +240,13 @@ private:
*/
void CloseClientCertContext(Kernel::HLERequestContext& ctx);
/**
* HTTP_C::Finalize service function
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void Finalize(Kernel::HLERequestContext& ctx);
void DecryptClCertA();
Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr;

View File

@ -52,6 +52,7 @@ struct MIC_U::Impl {
void UnmapSharedMem(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx, 0x02, 0, 0};
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
shared_memory = nullptr;
rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_MIC, "called");
}