diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index d3fa03657c5..6683848bc18 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -291,6 +291,8 @@ public:
     return true;
   }
 
+  void check_and_display_highlight_if_needed ();
+
   /* Can this window ever be highlighted?  */
   bool can_highlight = true;
 
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 27654629181..aaba94da467 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -369,7 +369,7 @@ tui_data_window::display_reg_element_at_line (int start_element_no,
 int
 tui_data_window::display_registers_from_line (int line_no)
 {
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   if (!regs_content.empty ())
     {
       int element_no;
@@ -436,7 +436,7 @@ void
 tui_data_window::erase_data_content (const char *prompt)
 {
   werase (handle);
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   if (prompt != NULL)
     {
       int half_width = (width - 2) / 2;
@@ -462,7 +462,7 @@ tui_data_window::display_all_data ()
     {
       erase_data_content (NULL);
       delete_data_content_windows ();
-      tui_check_and_display_highlight_if_needed (this);
+      check_and_display_highlight_if_needed ();
       display_registers_from (0);
     }
 }
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 0e64db3e7a1..f8238c7303e 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -515,7 +515,7 @@ void
 tui_rehighlight_all (void)
 {
   for (tui_win_info *win_info : all_tui_windows ())
-    tui_check_and_display_highlight_if_needed (win_info);
+    win_info->check_and_display_highlight_if_needed ();
 }
 
 /* Resize all the windows based on the terminal size.  This function
@@ -1205,7 +1205,7 @@ void
 tui_win_info::make_visible_with_new_height ()
 {
   make_visible (true);
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   do_make_visible_with_new_height ();
 }
 
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 79f93ceaf9f..8ff5aa5fce8 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -112,15 +112,14 @@ tui_highlight_win (struct tui_win_info *win_info)
 }
 
 void
-tui_check_and_display_highlight_if_needed (struct tui_win_info *win_info)
+tui_win_info::check_and_display_highlight_if_needed ()
 {
-  if (win_info != NULL && win_info->can_highlight)
+  if (can_highlight)
     {
-      if (win_info->is_highlighted)
-	tui_highlight_win (win_info);
+      if (is_highlighted)
+	tui_highlight_win (this);
       else
-	tui_unhighlight_win (win_info);
-
+	tui_unhighlight_win (this);
     }
 }
 
diff --git a/gdb/tui/tui-wingeneral.h b/gdb/tui/tui-wingeneral.h
index 051be6da690..54d6eb684f7 100644
--- a/gdb/tui/tui-wingeneral.h
+++ b/gdb/tui/tui-wingeneral.h
@@ -33,7 +33,6 @@ extern void tui_make_all_invisible (void);
 extern void tui_unhighlight_win (struct tui_win_info *);
 extern void tui_make_window (struct tui_gen_win_info *, enum tui_box);
 extern void tui_highlight_win (struct tui_win_info *);
-extern void tui_check_and_display_highlight_if_needed (struct tui_win_info *);
 extern void tui_refresh_all ();
 extern void tui_delete_win (WINDOW *window);
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 3de2692deea..6a72c6fe74b 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -225,7 +225,7 @@ tui_erase_source_content (struct tui_source_window_base *win_info)
   if (win_info->handle != NULL)
     {
       werase (win_info->handle);
-      tui_check_and_display_highlight_if_needed (win_info);
+      win_info->check_and_display_highlight_if_needed ();
 
       const char *no_src_str;
 
@@ -287,7 +287,7 @@ tui_show_source_content (struct tui_source_window_base *win_info)
   else
     tui_erase_source_content (win_info);
 
-  tui_check_and_display_highlight_if_needed (win_info);
+  win_info->check_and_display_highlight_if_needed ();
   win_info->refresh_window ();
 }
 
@@ -333,7 +333,7 @@ void
 tui_source_window_base::refresh_all ()
 {
   tui_show_source_content (this);
-  tui_check_and_display_highlight_if_needed (this);
+  check_and_display_highlight_if_needed ();
   tui_erase_exec_info_content (this);
   tui_update_exec_info (this);
 }
