debugger: Fix clipboard related crash

When copying an address from Cemu's debugger and pasting it into Cemu (anywhere) it would crash because the memory was released prematurely
This commit is contained in:
Exzap committed 2025-08-17 17:58:30 +02:00
1 parent d7c510ed31
commit aeb3154257
1 file changed
+2 -3
+2 -3
View File
@@ -693,7 +693,8 @@ void DisasmCtrl::OnMouseDClick(const wxPoint& position, uint32 line)
}
}
void DisasmCtrl::CopyToClipboard(std::string text) {
void DisasmCtrl::CopyToClipboard(std::string text)
{
#if BOOST_OS_WINDOWS
if (OpenClipboard(nullptr))
{
@@ -703,9 +704,7 @@ void DisasmCtrl::CopyToClipboard(std::string text) {
{
memcpy(GlobalLock(hGlobal), text.c_str(), text.size() + 1);
GlobalUnlock(hGlobal);
SetClipboardData(CF_TEXT, hGlobal);
GlobalFree(hGlobal);
}
CloseClipboard();
}