From 5e1702e7980a304f66fc74c5a0fac13161ae193b Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 24 Jul 2020 22:39:08 +0000 Subject: [PATCH] IDE, Debugger: prevent empty watches from being added. git-svn-id: trunk@63650 - --- debugger/evaluatedlg.pp | 2 ++ debugger/localsdlg.pp | 2 ++ debugger/watchpropertydlg.lfm | 3 ++- debugger/watchpropertydlg.pp | 9 +++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/debugger/evaluatedlg.pp b/debugger/evaluatedlg.pp index 78502fe95e..9cfc9feb35 100644 --- a/debugger/evaluatedlg.pp +++ b/debugger/evaluatedlg.pp @@ -378,6 +378,8 @@ var Watch: TCurrentWatch; begin S := cmbExpression.Text; + if s = '' then + exit; if DebugBoss.Watches.CurrentWatches.Find(S) = nil then begin DebugBoss.Watches.CurrentWatches.BeginUpdate; diff --git a/debugger/localsdlg.pp b/debugger/localsdlg.pp index ad4339a4ef..50a3793385 100644 --- a/debugger/localsdlg.pp +++ b/debugger/localsdlg.pp @@ -309,6 +309,8 @@ var Watch: TCurrentWatch; begin S := lvLocals.Selected.Caption; + if s = '' then + exit; if DebugBoss.Watches.CurrentWatches.Find(S) = nil then begin DebugBoss.Watches.CurrentWatches.BeginUpdate; diff --git a/debugger/watchpropertydlg.lfm b/debugger/watchpropertydlg.lfm index 53f36cf227..34d647b413 100644 --- a/debugger/watchpropertydlg.lfm +++ b/debugger/watchpropertydlg.lfm @@ -11,7 +11,7 @@ object WatchPropertyDlg: TWatchPropertyDlg ClientWidth = 428 Constraints.MinWidth = 400 Position = poScreenCenter - LCLVersion = '1.9.0.0' + LCLVersion = '2.1.0.0' object rgStyle: TRadioGroup Left = 6 Height = 104 @@ -105,6 +105,7 @@ object WatchPropertyDlg: TWatchPropertyDlg BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 + OnChange = txtExpressionChange TabOrder = 0 end object lblRepCount: TLabel diff --git a/debugger/watchpropertydlg.pp b/debugger/watchpropertydlg.pp index e388bad65d..d596025af8 100644 --- a/debugger/watchpropertydlg.pp +++ b/debugger/watchpropertydlg.pp @@ -61,6 +61,7 @@ type txtRepCount: TEdit; procedure btnHelpClick(Sender: TObject); procedure btnOKClick(Sender: TObject); + procedure txtExpressionChange(Sender: TObject); private FWatch: TIdeWatch; public @@ -82,6 +83,8 @@ const wdfStructure, wdfDefault, wdfMemDump, wdfBinary ); begin + if txtExpression.Text = '' then + exit; DebugBoss.Watches.CurrentWatches.BeginUpdate; try if FWatch = nil @@ -108,6 +111,11 @@ begin end; end; +procedure TWatchPropertyDlg.txtExpressionChange(Sender: TObject); +begin + ButtonPanel.OKButton.Enabled := txtExpression.Text <> ''; +end; + procedure TWatchPropertyDlg.btnHelpClick(Sender: TObject); begin LazarusHelp.ShowHelpForIDEControl(Self); @@ -142,6 +150,7 @@ begin chkUseInstanceClass.Checked := defClassAutoCast in FWatch.EvaluateFlags; txtRepCount.Text := IntToStr(FWatch.RepeatCount); end; + txtExpressionChange(nil); lblDigits.Enabled := False; txtDigits.Enabled := False;