[binutils-gdb] [gdb/tui] Always check for tui_try_activate result

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=96e98fcc7964b6645dd0aaf07eed4b38c110593a

commit 96e98fcc7964b6645dd0aaf07eed4b38c110593a
Author: Tom de Vries <[email protected]>
Date:   Thu Mar 19 10:55:46 2026 +0100

    [gdb/tui] Always check for tui_try_activate result
    
    There are two functions in which we call tui_try_activate, but don't check for
    the result.
    
    If it's not a bug, then it's an inconsistency.
    
    Fix this in both functions.
    
    Tested on x86_64-linux.
    
    Reviewed-By: Keith Seitz <[email protected]>

Diff:
---
 gdb/tui/tui.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 677a8c04b53..b6b6fb7acf5 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -219,9 +219,8 @@ tui_rl_delete_other_windows (int notused1, int notused2)
 static int
 tui_rl_other_window (int count, int key)
 {
-  tui_try_activate ();
-
-  tui_set_win_focus_to (tui_next_win (tui_win_with_focus ()));
+  if (tui_try_activate ())
+    tui_set_win_focus_to (tui_next_win (tui_win_with_focus ()));
 
   return 0;
 }
@@ -271,7 +270,8 @@ tui_rl_command_mode (int count, int key)
 static int
 tui_rl_next_keymap (int notused1, int notused2)
 {
-  tui_try_activate ();
+  if (!tui_try_activate ())
+    return 0;
 
   if (rl_end)
     {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.