From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ycEmDnG39GnsKgkAWB0awg (envelope-from ) for ; Fri, 01 May 2026 10:23:45 -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=LC8QAntC; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2FFCA1E0BA; Fri, 01 May 2026 10:23:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.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,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 6C9E01E067 for ; Fri, 01 May 2026 10:23:44 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 09143437422C for ; Fri, 1 May 2026 14:23:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09143437422C 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=LC8QAntC 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 D74B1437420F for ; Fri, 1 May 2026 14:23:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D74B1437420F 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 D74B1437420F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777645382; cv=none; b=oQsZJagBtqBkKqr1GVE1b1hIebfAxb27wRQcGVCrs5YeGy5+aHU4DNCuaRzDF3xxWLUUF10kybzniSe9bJXze1uueNQshxnPy1sRz1CIh3D8osXiVbRcZdl56PsKeuvUVZZX1GbvzjuAmH43V9lCDRhotDQMFe52UqQLPaWI0NM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777645382; c=relaxed/simple; bh=7RU6JKITkVjpmXGOikEKxUrV54Uy10e0kb/2hUZDjco=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=IjG1ZE02OSAdSJIt9YF0OcW1yPTz2SKC/0HNbDdwJCD0JgxWsLtvr6B1HG9rVh4QJXANbKGKmq2VmBU6EUuyAmA3OmY4E2EK2b1OFK3N/s5FIvUywnHhmKWIwfjqB6/hEVJHAhSGOOSGpiY/KXLv1uobnfRr9AAK+GqBcwtRWwc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D74B1437420F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777645382; 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=0lPkrIWaOmupJl60x+LkNa5iOaG9uwHVMMAow7FchXA=; b=LC8QAntCB7BeNfC2E0Qsc1BrMsZX7Vof3TyHVoYOtSVvybiYmHZBCSwziGrBCOMiRgmiMb 6HMpLMrkPznhjAbxH5N1aLDp7ua6Yjo/vwLkKp3DFr3TJtCNt1F8qxyai+duPLXdoLoOv/ pAfvUzv/sRcJkfwgXi8OMlOIL8VYL8o= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-4E-nFmGsM9ubMio9KDLE2w-1; Fri, 01 May 2026 10:23:01 -0400 X-MC-Unique: 4E-nFmGsM9ubMio9KDLE2w-1 X-Mimecast-MFC-AGG-ID: 4E-nFmGsM9ubMio9KDLE2w_1777645380 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-488c2a4e257so14284035e9.3 for ; Fri, 01 May 2026 07:23:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777645380; x=1778250180; 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; bh=0lPkrIWaOmupJl60x+LkNa5iOaG9uwHVMMAow7FchXA=; b=szbCyXk/tgfTZkr+uw+pozRj5agwaKqGlO/2OoRR/PJd2tWasCmDIIhKSNJidFH7Ek kP6H2o22nkMLDpWGkw2H7lMY2gBXBVTCYhSDIn50ynxZmdVjd1f14cG/nEGlDI0fckqy mDhejJyJdJ5iPdFwbmQUWgDChwzcNWp5W85YujYlhGNPn/tRKVu9rYu4lYXX34KQy9tF /owCbXRFehVXEkEAWIkCesub8kzeWvfYf0mwoL71wl7Tq3QM31eD67iEPtsspAs/3fqt wBXInL9b+YFDDurhOdM+96wRvqMs1vC2uSWkAjN25+v1sF2MXz+mg+8QN3NJ3ahSptoD tkJg== X-Gm-Message-State: AOJu0Yw7t0unDxviLwh5pSB9riPbQIM8wXYIo6p/ZG9G6A/zpmHY5pjn c7Z1bpHjqUhluLZffMwORGe3DBphLAViJpxIq+BLrpbksH807Djb6ITwGRuLitXt+znoZXlGgBV xZTDgiHgI8d2T8DO10voQG49k8Q7uqOjkhQe/xecz91MeOTYrGhytALiZc4LaLrAHo3by3iF3wh 2R6TbKmw6J4xjrRe9WwAjKCiKRwAU9pOxiukltUk5Z29A+6Tc= X-Gm-Gg: AeBDieumrQ1a0HbN7ENrwXSy0ak2sku4LT0WUjsgCfYJxlf6a8KIywoxMbJIz18VrCr ltt0MwbHFg0TXRerrDBX/f/ICxoKVicrYJDV5bJJ9baDzSfmL7sbElnaAcntUun47QXPHvAxS37 bjtlU5asmLwABnyAMyLi7AuROlFnXA9rq+sYGCrFJndepFMpmJf33KziHTpyRxSxKkJmFAf2b3v tK+JhwqrEwo6zrKX8PrsZ7rh8FzO0k8hs0a3ZIDLeYn5/bSAJ+fp6w3VF7THjdJtAE73qAoXaFu IWtwD9uqH3j/vDyQrvR7c4Mk2x3abvTxKc01uCpGNpS+q6IJx+Tnn86qkBHJ0xAk4MjtIxz5/yj cIckgUpRVJy7AznmxTpLyHZPvk1I= X-Received: by 2002:a05:600c:8288:b0:489:a4:e578 with SMTP id 5b1f17b1804b1-48a8eb8a3camr48517535e9.14.1777645379779; Fri, 01 May 2026 07:22:59 -0700 (PDT) X-Received: by 2002:a05:600c:8288:b0:489:a4:e578 with SMTP id 5b1f17b1804b1-48a8eb8a3camr48517185e9.14.1777645379341; Fri, 01 May 2026 07:22:59 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a8eba8487sm51722605e9.11.2026.05.01.07.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 May 2026 07:22:59 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 1/6] gdb/tui: convert a window handle `if` into an `assert` Date: Fri, 1 May 2026 15:22:51 +0100 Message-Id: <3846c3c560509b21e2e05efae618b3a9fe1ef6f8.1777645161.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: moqzVRf51LLjkLU25wpTTzoNt-wRGlxXx6Hmk_MdMyQ_1777645380 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 tui_win_info::handle. 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 86f13d275b4..cd04876ad1b 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 8609a7cd4fe..d040019563c 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