texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7812] fix crash in tree-search-next


From: gavinsmith0123
Subject: [7812] fix crash in tree-search-next
Date: Wed, 24 May 2017 02:58:12 -0400 (EDT)

Revision: 7812
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7812
Author:   gavin
Date:     2017-05-24 02:58:11 -0400 (Wed, 24 May 2017)
Log Message:
-----------
fix crash in tree-search-next

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/session.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-05-21 20:37:48 UTC (rev 7811)
+++ trunk/ChangeLog     2017-05-24 06:58:11 UTC (rev 7812)
@@ -1,3 +1,13 @@
+2017-05-24  Gavin Smith  <address@hidden>
+
+       * info/session.c (tree_search_check_node) <no more matches>: Add
+       the "Top" node to the window history, instead of using a
+       menu entry in the current node (as the current node may not
+       have a menu).  Otherwise, if a tree search was rooted at a node
+       without a menu, 'active_menu' would be left with an invalid 
+       value, leading to a crash if it was used again when the user did 
+       a 'tree-search-next' command.  Report from Benno Schulenberg.
+
 2017-05-21  Gavin Smith  <address@hidden>
 
        * info/info.c (info_short_help): Remove full stops from the ends 

Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c        2017-05-21 20:37:48 UTC (rev 7811)
+++ trunk/info/session.c        2017-05-24 06:58:11 UTC (rev 7812)
@@ -4405,15 +4405,15 @@
   /* Go back to the final match. */
   if (previous_match)
     {
-      REFERENCE *mentry;
-
       message_in_echo_area (_("Going back to last match from %s"),
                             window->node->nodename);
 
-      /* This is a trick.  Add an arbitrary node to the window history,
-         but set active_menu to one more than the number of references.  When
-         we call tree_search_check_node_backwards, this will repeatedly go 
down 
-         the last menu entry for us. */
+      /* This is a trick.
+         Set active_menu to one more than the number of references,
+         and add an arbitrary node to the window history.
+         When we call tree_search_check_node_backwards, this will go
+         backwards through the tree structure to the last match.
+         Change active_menu back to a valid value afterwards .*/
       {
         int n = 0;
 
@@ -4421,11 +4421,14 @@
           n++;
         window->node->active_menu = n + 1;
 
-        mentry = select_menu_digit (window, '1');
-        if (!mentry)
-          goto funexit;
-        if (!info_select_reference (window, mentry))
-          goto funexit;
+        info_parse_and_select ("Top", window);
+        /* Check if this worked. */
+        if (strcmp (window->node->nodename, "Top"))
+          {
+            /* Loading "Top" node failed. */
+            window->node->active_menu = 0;
+            goto funexit;
+          }
         window->node->active_menu = BEFORE_MENU;
       }
       window->point = window->node->body_start;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]