Source-Changes-HG archive

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

[src/netbsd-1-6]: src/usr.bin/menuc Pullup hand patch (requested by martin in...



details:   https://anonhg.NetBSD.org/src/rev/02be49e71c68
branches:  netbsd-1-6
changeset: 531042:02be49e71c68
user:      jmc <jmc%NetBSD.org@localhost>
date:      Wed Dec 24 04:33:36 2003 +0000

description:
Pullup hand patch (requested by martin in ticket #1571)
The opt_action function may allocate new menus,
which may make m a stale pointer into the old
menus array. So re-target it.

diffstat:

 usr.bin/menuc/menu_sys.def |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r cc3cf41156a2 -r 02be49e71c68 usr.bin/menuc/menu_sys.def
--- a/usr.bin/menuc/menu_sys.def        Wed Dec 24 04:28:02 2003 +0000
+++ b/usr.bin/menuc/menu_sys.def        Wed Dec 24 04:33:36 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: menu_sys.def,v 1.29 2002/04/04 14:11:23 blymn Exp $    */
+/*     $NetBSD: menu_sys.def,v 1.29.2.1 2003/12/24 04:33:36 jmc Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -595,6 +595,14 @@
                        }
                        if (m->opts[sel].opt_action)
                                done = (*m->opts[sel].opt_action)(m);
+
+                       /*      
+                        * The opt_action function may allocate new menus,
+                        * which may make m a stale pointer into the old  
+                        * menus array. So re-target it.
+                        */
+                       m = &menus[num];
+
                        if (m->opts[sel].opt_menu != -1) {
                                if (m->opts[sel].opt_flags & OPT_SUB)
                                        process_menu (m->opts[sel].opt_menu);



Home | Main Index | Thread Index | Old Index