diff --git a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp index f1795b108..205ff76ba 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-Commands.cpp @@ -78,7 +78,7 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA m_StepOverButton.Attach(GetDlgItem(IDC_STEPOVER_BTN)); m_SkipButton.Attach(GetDlgItem(IDC_SKIP_BTN)); m_GoButton.Attach(GetDlgItem(IDC_GO_BTN)); - m_RegisterTabs.Attach(GetDlgItem(IDC_REG_TABS)); + m_RegisterTabs.Attach(GetDlgItem(IDC_REG_TABS), m_Debugger); m_Scrollbar.Attach(GetDlgItem(IDC_SCRL_BAR)); m_BackButton.Attach(GetDlgItem(IDC_BACK_BTN)); m_ForwardButton.Attach(GetDlgItem(IDC_FORWARD_BTN)); @@ -88,8 +88,6 @@ LRESULT CDebugCommandsView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARA DlgSavePos_Init(DebuggerUI_CommandsPos); DlgToolTip_Init(); - m_RegisterTabs.SetDebugger(m_Debugger); - // Setup address input m_AddressEdit.SetDisplayType(CEditNumber32::DisplayHex); m_AddressEdit.SetLimitText(8); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp index bfdb54a54..90116a56e 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp +++ b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.cpp @@ -26,8 +26,9 @@ CRegisterTabs::~CRegisterTabs() { } -void CRegisterTabs::Attach(HWND hWndNew) +void CRegisterTabs::Attach(HWND hWndNew, CDebuggerUI* debugger) { + m_Debugger = debugger; CTabCtrl::Attach(hWndNew); m_GPRTab = AddTab("GPR", IDD_Debugger_RegGPR, TabProcGPR); @@ -562,6 +563,11 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L // right click labels if (msg == WM_CONTEXTMENU) { + if (m_Debugger == NULL) + { + return FALSE; + } + HWND hWnd = (HWND)wParam; WORD ctrlId = (WORD) ::GetWindowLong(hWnd, GWL_ID); @@ -594,6 +600,11 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L // click labels if (msg == WM_COMMAND && HIWORD(wParam) == STN_CLICKED || HIWORD(wParam) == STN_DBLCLK) { + if (m_Debugger == NULL) + { + return FALSE; + } + HWND hWnd = (HWND)lParam; WORD ctrlId = LOWORD(wParam); @@ -626,6 +637,11 @@ INT_PTR CALLBACK CRegisterTabs::TabProcGPR(HWND hDlg, UINT msg, WPARAM wParam, L // color labels if (msg == WM_CTLCOLORSTATIC) { + if (m_Debugger == NULL) + { + return FALSE; + } + HWND hWnd = (HWND)lParam; WORD ctrlId = (WORD) ::GetWindowLong(hWnd, GWL_ID); @@ -772,11 +788,6 @@ void CRegisterTabs::SetColorsEnabled(bool bColorsEnabled) m_bColorsEnabled = bColorsEnabled; } -void CRegisterTabs::SetDebugger(CDebuggerUI* debugger) -{ - m_Debugger = debugger; -} - void CRegisterTabs::InitRegisterEdit(CWindow& tab, CEditNumber32& edit, WORD ctrlId) { edit.Attach(tab.GetDlgItem(ctrlId)); diff --git a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h index 2849868e7..359926c3c 100644 --- a/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h +++ b/Source/Project64/UserInterface/Debugger/Debugger-RegisterTabs.h @@ -45,7 +45,7 @@ public: CRegisterTabs(void); ~CRegisterTabs(); - void Attach(HWND hWndNew); + void Attach(HWND hWndNew, CDebuggerUI* debugger); HWND Detach(); CWindow AddTab(char* caption, int dialogId, DLGPROC dlgProc); @@ -54,7 +54,6 @@ public: void RedrawCurrentTab(); void RefreshEdits(); void SetColorsEnabled(bool bColorsEnabled); - void SetDebugger(CDebuggerUI* debugger); private: CRegisterTabs(const CRegisterTabs&); // Disable copy constructor