From alex@alexwang.com  Mon Feb 24 08:57:06 2003
Return-Path: <alex@alexwang.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B670D37B401
	for <freebsd-gnats-submit@freebsd.org>; Mon, 24 Feb 2003 08:57:06 -0800 (PST)
Received: from alexwang.com (alexwang.com [61.218.0.204])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5757943F3F
	for <freebsd-gnats-submit@freebsd.org>; Mon, 24 Feb 2003 08:57:05 -0800 (PST)
	(envelope-from alex@alexwang.com)
Received: (from root@localhost)
	by alexwang.com (8.12.6/8.12.6) id h1OGvkdI009481;
	Tue, 25 Feb 2003 00:57:46 +0800 (CST)
Received: from alexwang.com (localhost.alexwang.com [127.0.0.1])
	by alexwang.com (8.12.6/8.12.6av) with ESMTP id h1OGvacE009448;
	Tue, 25 Feb 2003 00:57:36 +0800 (CST)
Received: (from root@localhost)
	by alexwang.com (8.12.6/8.12.6/Submit) id h1OGvZZt009447;
	Tue, 25 Feb 2003 00:57:35 +0800 (CST)
Message-Id: <200302241657.h1OGvZZt009447@alexwang.com>
Date: Tue, 25 Feb 2003 00:57:35 +0800 (CST)
From: Alex Wang <alex@alexwang.com>
Reply-To: Alex Wang <alex@alexwang.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: alex@alexwang.com
Subject: [PATCH] some bug fixs in libdialog 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         48638
>Category:       gnu
>Synopsis:       [libdialog] [patch] some bug fixes in libdialog
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 24 09:00:28 PST 2003
>Closed-Date:    Tue Aug 02 04:08:15 UTC 2011
>Last-Modified:  Tue Aug 02 04:08:33 UTC 2011
>Originator:     Alex Wang
>Release:        FreeBSD 4.7-RELEASE i386
>Organization:
>Environment:
System: FreeBSD alexwang.com 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Mon Oct 14 05:21:51 CST 2002 alex@alexwang.com:/usr/src/sys/compile/ALEX i386


	
>Description:
	
1.checklist.c:
	Enable user to set the position of checklist.
2.fselect.c:
	Memory leak problem in dir select memu.
	In dialog_dselect() menu, press cancel but return TURE, which
	should be FALSE.
3.menubox.c:
	In dialog_menu(), if we can input a (int *) to set the position
	of light bar. After user move the light bar, we have to change
	the (int *) that user input to record the current position.
	This enables user to memorize the selected item and places the
	light bar in the right position next time we show the menu.

>How-To-Repeat:
	
>Fix:
***************** For RELENG_4 **********************
Index: checklist.c
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libdialog/checklist.c,v
retrieving revision 1.35.2.2
diff -u -b -r1.35.2.2 checklist.c
--- checklist.c	2001/08/31 03:04:59	1.35.2.2
+++ checklist.c	2003/02/24 16:20:03
@@ -113,7 +113,7 @@
 	height = LINES;
     /* center dialog box on screen */
     x = (COLS - width)/2;
-    y = (LINES - height)/2;
+    y = DialogY ? DialogY : (LINES - height)/2;
 
 #ifdef HAVE_NCURSES
     if (use_shadow)
Index: fselect.c
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libdialog/fselect.c,v
retrieving revision 1.5
diff -u -b -r1.5 fselect.c
--- fselect.c	1997/02/18 14:26:19	1.5
+++ fselect.c	2003/02/24 16:20:03
@@ -210,7 +210,10 @@
  * Desc: Choose a directory
  */
 {
-    if (dialog_dfselect(dir, fmask, FALSE)) {
+	char *szSelDir;
+    szSelDir = dialog_dfselect(dir, fmask, FALSE);
+    if (szSelDir) {
+	free(szSelDir);
 	return(FALSE);	/* esc or cancel was pressed */
     } else {
 	return(TRUE);   /* directory was selected */
@@ -391,12 +394,14 @@
     FreeNames(fnames, nf);
     delwin(fs_win);
 
-    if (cancel || (strlen(o_sel) == 0)) {
+    if (is_fselect && cancel) {
 	return(NULL);
-    } else {
+    }else if (cancel || (is_fselect &&(strlen(o_sel) != 0))) {
 	ret_name = (char *) malloc( strlen(o_sel) + 1 );
 	strcpy(ret_name, o_sel);
 	return(ret_name);
+    } else {
+	return(NULL);
     }
 } /* dialog_fselect() */
 
Index: menubox.c
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libdialog/menubox.c,v
retrieving revision 1.35.2.1
diff -u -b -r1.35.2.1 menubox.c
--- menubox.c	2001/07/31 20:34:00	1.35.2.1
+++ menubox.c	2003/02/24 16:20:03
@@ -392,6 +392,9 @@
 			    delwin(menu);
 			    delwin(dialog);
 			    dialog_clear();
+				if (ch) {
+					*ch = choice;
+				}
 			    goto draw;
 			}
 		    }

***************** End of RELENG_4 ****************


***************** FOR CURRENT  ******************
Index: checklist.c
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libdialog/checklist.c,v
retrieving revision 1.38
diff -u -b -r1.38 checklist.c
--- checklist.c	2001/08/31 01:56:06	1.38
+++ checklist.c	2003/02/24 16:20:51
@@ -113,7 +113,7 @@
 	height = LINES;
     /* center dialog box on screen */
     x = (COLS - width)/2;
-    y = (LINES - height)/2;
+    y = DialogY ? DialogY : (LINES - height)/2;
 
 #ifdef HAVE_NCURSES
     if (use_shadow)
Index: fselect.c
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libdialog/fselect.c,v
retrieving revision 1.5
diff -u -b -r1.5 fselect.c
--- fselect.c	1997/02/18 14:26:19	1.5
+++ fselect.c	2003/02/24 16:20:51
@@ -210,7 +210,10 @@
  * Desc: Choose a directory
  */
 {
-    if (dialog_dfselect(dir, fmask, FALSE)) {
+	char *szSelDir;
+    szSelDir = dialog_dfselect(dir, fmask, FALSE);
+    if (szSelDir) {
+	free(szSelDir);
 	return(FALSE);	/* esc or cancel was pressed */
     } else {
 	return(TRUE);   /* directory was selected */
@@ -391,12 +394,14 @@
     FreeNames(fnames, nf);
     delwin(fs_win);
 
-    if (cancel || (strlen(o_sel) == 0)) {
+    if (is_fselect && cancel) {
 	return(NULL);
-    } else {
+    }else if (cancel || (is_fselect &&(strlen(o_sel) != 0))) {
 	ret_name = (char *) malloc( strlen(o_sel) + 1 );
 	strcpy(ret_name, o_sel);
 	return(ret_name);
+    } else {
+	return(NULL);
     }
 } /* dialog_fselect() */
 
Index: menubox.c
===================================================================
RCS file: /home/ncvs/src/gnu/lib/libdialog/menubox.c,v
retrieving revision 1.36
diff -u -b -r1.36 menubox.c
--- menubox.c	2001/07/18 05:21:36	1.36
+++ menubox.c	2003/02/24 16:20:51
@@ -392,6 +392,9 @@
 			    delwin(menu);
 			    delwin(dialog);
 			    dialog_clear();
+				if (ch) {
+					*ch = choice;
+				}
 			    goto draw;
 			}
 		    }
========================================================

	


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: eadler 
State-Changed-When: Thu Feb 24 08:11:48 EST 2011 
State-Changed-Why:  
Is this still an issue with the recent dialog update? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48638 
State-Changed-From-To: feedback->closed 
State-Changed-By: eadler 
State-Changed-When: Tue Aug 2 04:08:13 UTC 2011 
State-Changed-Why:  
Feedback timeout. If this is still an issue poke me and I'll re-open 
it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=48638 
>Unformatted:
