From 6bf58274078339aae062899b783dafa5bd3d13c8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 15 Mar 2023 22:02:36 -0700 Subject: [PATCH 1/2] Windows: Fix small atom leak. --- Windows/TouchInputHandler.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Windows/TouchInputHandler.cpp b/Windows/TouchInputHandler.cpp index 63b25934de..56b91c5275 100644 --- a/Windows/TouchInputHandler.cpp +++ b/Windows/TouchInputHandler.cpp @@ -98,24 +98,18 @@ void TouchInputHandler::handleTouchEvent(HWND hWnd, UINT message, WPARAM wParam, // from http://msdn.microsoft.com/en-us/library/ms812373.aspx // disable the press and hold gesture for the given window -void TouchInputHandler::disablePressAndHold(HWND hWnd) -{ +void TouchInputHandler::disablePressAndHold(HWND hWnd) { // The atom identifier and Tablet PC atom - ATOM atomID = 0; LPCTSTR tabletAtom = _T("MicrosoftTabletPenServiceProperty"); - - // Get the Tablet PC atom ID - atomID = GlobalAddAtom(tabletAtom); + ATOM atomID = GlobalAddAtom(tabletAtom); // If getting the ID failed, return false - if (atomID == 0) - { - return; + if (atomID != 0) { + // Try to disable press and hold gesture by setting the window property. + SetProp(hWnd, tabletAtom, (HANDLE)1); } - - // Try to disable press and hold gesture by - // setting the window property, return the result - SetProp(hWnd, tabletAtom, (HANDLE)1); + + GlobalDeleteAtom(atomID); } void TouchInputHandler::touchUp(int id, float x, float y){ From 3fcecfa5ec2d898b5b2393a2aa0e2b2a62f4679b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 15 Mar 2023 22:02:56 -0700 Subject: [PATCH 2/2] Atrac: Ensure codecCtx doesn't leak. Although, I don't think we're reallocating it. --- Core/HLE/sceAtrac.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index dac70d4b27..bf16281139 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -1853,6 +1853,11 @@ int __AtracSetContext(Atrac *atrac) { return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unknown codec type in set context"); } + if (atrac->codecCtx_) { + // Shouldn't happen, but just in case. + atrac->ReleaseFFMPEGContext(); + } + const AVCodec *codec = avcodec_find_decoder(ff_codec); atrac->codecCtx_ = avcodec_alloc_context3(codec);