From f62eb4848df3d9d9eb99f40cf4ed1ac6397b9a41 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 17 Feb 2014 21:08:34 -0800 Subject: [PATCH] Add a few more safety checks for SendMessage(). Broadcasting is bad. --- Windows/Debugger/Debugger_Disasm.cpp | 2 +- Windows/Debugger/Debugger_MemoryDlg.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 03a7074485..97a233af20 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -641,7 +641,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) case WM_DEB_SETSTATUSBARTEXT: if (!keepStatusBarText) - SendMessage(statusBarWnd,WM_SETTEXT,0,(LPARAM)ConvertUTF8ToWString((const char *)lParam).c_str()); + SetWindowText(statusBarWnd, ConvertUTF8ToWString((const char *)lParam).c_str()); break; case WM_DEB_GOTOHEXEDIT: { diff --git a/Windows/Debugger/Debugger_MemoryDlg.cpp b/Windows/Debugger/Debugger_MemoryDlg.cpp index fd912d9930..096128c34f 100644 --- a/Windows/Debugger/Debugger_MemoryDlg.cpp +++ b/Windows/Debugger/Debugger_MemoryDlg.cpp @@ -17,7 +17,7 @@ RECT CMemoryDlg::slRect; FAR WNDPROC DefAddressEditProc; -HWND AddressEditParentHwnd; +HWND AddressEditParentHwnd = 0; LRESULT CALLBACK AddressEditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { @@ -26,7 +26,8 @@ LRESULT CALLBACK AddressEditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM case WM_KEYDOWN: if( wParam == VK_RETURN ) { - SendMessage(AddressEditParentHwnd,WM_DEB_GOTOADDRESSEDIT,0,0); + if (AddressEditParentHwnd != 0) + SendMessage(AddressEditParentHwnd,WM_DEB_GOTOADDRESSEDIT,0,0); return 0; } case WM_KEYUP: