From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MbTHJuO/UGptkAEAWB0awg (envelope-from ) for ; Fri, 10 Jul 2026 05:48:19 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OitOGTUO; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9724F1E0A6; Fri, 10 Jul 2026 05:48:19 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C75271E070 for ; Fri, 10 Jul 2026 05:48:18 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E85784BA2E20 for ; Fri, 10 Jul 2026 09:48:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E85784BA2E20 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OitOGTUO Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id E7B264BA2E07 for ; Fri, 10 Jul 2026 09:47:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E7B264BA2E07 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E7B264BA2E07 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783676846; cv=none; b=igm0TlzyFC2XsMapiLLCLMcvIKwf6Dhmxu3kvVZvQcnRyZG8gIhf4z9nhL9nxcCXxK+GnArIpzeSZNDTdxzzk7SbuoeijbUwEu65e9DJt0DazOTTaOKvjj0cYk6wCpxit2d0rpR++OvGyWULySZiwVEZNB+/EhiKa3iIriZ0Pdo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783676846; c=relaxed/simple; bh=G9AdKC+gLe826xeZuRHIOe4Gz7OsrgUcmTmBuMegyeE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=GjLGCieRUlyZJPmP+BQ04DYKHXw5C26V93aKIBngMPac8MzB4ipi9hTTmPELs+xAQV7+huJuE5CPXGOPRExKeVvmFUqcM4s887WlFs0VK5eex3YpBRTg0qi4Jx8JA2mZvDFZf5WPd3j7Q8SgFo0FbbmEL+J5K+ZAB7BRXd+wqRU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OitOGTUO DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7B264BA2E07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783676845; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=exyqjNMnOBKpa87Hu8rft93yKwLHs0Dt4gTprkFjlUg=; b=OitOGTUOf1gumB0yVSFxJXPo6N+dE0SyyE4i/SDhgoedCwNwVeJt82fx+Ji8Rs+GTue77N uon8aVmVNcAbIsXTNUCLDEqnUOjFKNE8dHZDa9WmvWakEzrig1eJD8zMGeXaxxfxFkaSdC 0Dr+icdgWQN22M1fy1tsYB/jfFvhOfk= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-37-ZY-IGulsOYGeb9B54sBWfw-1; Fri, 10 Jul 2026 05:47:24 -0400 X-MC-Unique: ZY-IGulsOYGeb9B54sBWfw-1 X-Mimecast-MFC-AGG-ID: ZY-IGulsOYGeb9B54sBWfw_1783676843 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-473bc66c837so692614f8f.0 for ; Fri, 10 Jul 2026 02:47:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783676843; x=1784281643; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=exyqjNMnOBKpa87Hu8rft93yKwLHs0Dt4gTprkFjlUg=; b=C2cvxljt7vrK18wd+Sg+NwVX/pvkg2m1I36WhXJMin6JTcFj9odzFY7DG+kYAF9/GX jRqWWs/f+qkXRosR3aUuJsipVynxaj+dTSQhqjgdCRscNYmNMB6JXCMWCKlq33isbQVP bfrHrBdAgnWPCx7agknG2yQZFiXecAZw8I5pGhdKwZcYJsRiXZxwmprt04fS7NaWrKmf MYj2bSU5rY2H88/U8btMs9cvnovzJmWdI0EJ3zQ8eseKZB5wo1stuQZj9EQgvbO5JOj6 gxcjnOGI9mF/owQAwQvMkR5fgV4eWVxdH8YsVqj9+OuD1Ddm2NKQoBWdIaFBFtPSs5Bz kgmg== X-Gm-Message-State: AOJu0YwYrUOBw67zBrBIi0u0Kq3BgNbBNX2zTwQsyiseKgBho0saL2do 3U9OulLq9JmBtBsA5ZXCtyy7J+cBrltGwIiI7MlBT2ChI+Z3IEsISlxfantCUraSLXq0NOx9Y0W eY0G2+6mqkiZfuYWAnffhyoc/7MMxyr+Era9+Kzbw3kDEOMYW+7UprI93xXGGRfsjrPDdj6EPV4 nEZ/i5m3VFLmXD34zxPaNxqXJ7aMMg+cHLX7/XqBpq4TDPeEE= X-Gm-Gg: AfdE7cldrUd13OOZAkkxR+zHkOnjlxtvY/jjPz3423L6p5expqJDQmNAul55+2+uxnD sg8x9HdZYCz0gJ8/BTGWE40mUKH/FqdoVcEfTeAuRKMMQQI5dUAqaWAFlbvtbSoX1Hxu6njOMbf 9IO8LqoW87O9KW5jtBG6oylfoP5xYs3LqINOxLyypV5dYlsE4uQlvikrNdasKr0DWGb7vjvOX/K 8UxjLo5pxCw4XkhkawUn5VTLR8RRnE+3X2KWmM7VE2YYu2t8n9HaYYvmON3WIos8lyY0Ykoz1w/ SzpeXMufOCoqFAnl3rUNoYkdGHxskth6WiexqoJsQR22fXdGXRmA49nYBo3rWU+ccoBNwApXxCb KaeVj6f8= X-Received: by 2002:a05:6000:4b04:b0:47e:9f03:e542 with SMTP id ffacd0b85a97d-47e9f03e597mr4002140f8f.45.1783676843138; Fri, 10 Jul 2026 02:47:23 -0700 (PDT) X-Received: by 2002:a05:6000:4b04:b0:47e:9f03:e542 with SMTP id ffacd0b85a97d-47e9f03e597mr4002104f8f.45.1783676842592; Fri, 10 Jul 2026 02:47:22 -0700 (PDT) Received: from localhost ([31.111.209.233]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47aa039af67sm66036775f8f.17.2026.07.10.02.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 02:47:22 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 1/6] gdb/tui: convert a window handle `if` into an `assert` Date: Fri, 10 Jul 2026 10:47:13 +0100 Message-Id: <06623277fe8eeb0932593f7a43589f3b4ce22294.1783676703.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pxeKd8OEfX9ZWsphnD9SN7SKLN0J5S1WB0lacX5kuuQ_1783676843 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org It should only be possible to call tui_win_info::refresh_window on a window with a valid handle member. To do otherwise would suggest we're trying to draw to the screen a window which GDB doesn't think is part of the current layout, which is just wrong. Currently tui_win_info::refresh_window guards its content with an `if (handle != NULL)`, but this can be changed to an assert. A similar assert can be added to tui_source_window_base::refresh_window, there's no `if` in this function, which only backs up the reasoning in the first paragraph. There should be no user-visible changes after this commit. --- gdb/tui/tui-wingeneral.c | 13 ++++++------- gdb/tui/tui-winsource.c | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index 149ca4efc6e..281c56d475e 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -55,13 +55,12 @@ tui_batch_rendering::~tui_batch_rendering () void tui_win_info::refresh_window () { - if (handle != NULL) - { - if (suppress_output) - wnoutrefresh (handle.get ()); - else - wrefresh (handle.get ()); - } + gdb_assert (handle != nullptr); + + if (suppress_output) + wnoutrefresh (handle.get ()); + else + wrefresh (handle.get ()); } /* Draw a border around the window. */ diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index e3f64892e27..c7149ff7c80 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -310,6 +310,8 @@ tui_source_window_base::refresh_window () { TUI_SCOPED_DEBUG_START_END ("window `%s`", name ()); + gdb_assert (handle != nullptr); + /* tui_win_info::refresh_window would draw the empty background window to the screen, potentially creating a flicker. */ wnoutrefresh (handle.get ()); -- 2.25.4