From ab45b7e663590d9f2a0ae82cc2fa7ae87405125a Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Fri, 18 Nov 2011 19:44:17 +0100
Subject: [PATCH] debugger: Disable setting of watchpoints on non-existing
 variables

Task-number: QTCREATORBUG-5830
Change-Id: Iad4683c812e3f8debc3fe5852ee36adc4e5786ae
Reviewed-by: hjk <qthjk@ovi.com>
---
 src/plugins/debugger/watchwindow.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index ef90e1bfcf8..28bef18d5c4 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -736,9 +736,17 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
         tr("Setting a data breakpoint on an address will cause the program "
            "to stop when the data at the address is modified."));
 
-    QAction *actSetWatchpointAtExpression =
+    QAction *actSetWatchpointAtExpression = 0;
+    if (name.isEmpty()) {
+        actSetWatchpointAtExpression =
+            new QAction(tr("Add Data Breakpoint at Expression"),
+                &breakpointMenu);
+        actSetWatchpointAtExpression->setEnabled(false);
+    } else {
+        actSetWatchpointAtExpression =
             new QAction(tr("Add Data Breakpoint at Expression \"%1\"").arg(name),
                 &breakpointMenu);
+    }
     actSetWatchpointAtExpression->setToolTip(
         tr("Setting a data breakpoint on an expression will cause the program "
            "to stop when the data at the address given by the expression "
-- 
GitLab