Karsten Hopp 3dd886
To: vim-dev@vim.org
Karsten Hopp 3dd886
Subject: Patch 7.2.271
Karsten Hopp 3dd886
Fcc: outbox
Karsten Hopp 3dd886
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 3dd886
Mime-Version: 1.0
Karsten Hopp 3dd886
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 3dd886
Content-Transfer-Encoding: 8bit
Karsten Hopp 3dd886
------------
Karsten Hopp 3dd886
Karsten Hopp 3dd886
Patch 7.2.271
Karsten Hopp 3dd886
Problem:    Using freed memory in Motif GUI version when making a choice.
Karsten Hopp 3dd886
Solution:   Free memory only after using it. (Dominique Pelle)
Karsten Hopp 3dd886
Files:	    src/gui_xmdlg.c
Karsten Hopp 3dd886
Karsten Hopp 3dd886
Karsten Hopp 3dd886
*** ../vim-7.2.270/src/gui_xmdlg.c	2009-05-21 23:25:38.000000000 +0200
Karsten Hopp 3dd886
--- src/gui_xmdlg.c	2009-10-28 21:56:15.000000000 +0100
Karsten Hopp 3dd886
***************
Karsten Hopp 3dd886
*** 10,16 ****
Karsten Hopp 3dd886
  /*
Karsten Hopp 3dd886
   * (C) 2001,2005 by Marcin Dalecki <martin@dalecki.de>
Karsten Hopp 3dd886
   *
Karsten Hopp 3dd886
!  * Implementation of dialogue functions for the Motif GUI variant.
Karsten Hopp 3dd886
   *
Karsten Hopp 3dd886
   * Note about Lesstif: Apparently lesstif doesn't get the widget layout right,
Karsten Hopp 3dd886
   * when using a dynamic scrollbar policy.
Karsten Hopp 3dd886
--- 10,16 ----
Karsten Hopp 3dd886
  /*
Karsten Hopp 3dd886
   * (C) 2001,2005 by Marcin Dalecki <martin@dalecki.de>
Karsten Hopp 3dd886
   *
Karsten Hopp 3dd886
!  * Implementation of dialog functions for the Motif GUI variant.
Karsten Hopp 3dd886
   *
Karsten Hopp 3dd886
   * Note about Lesstif: Apparently lesstif doesn't get the widget layout right,
Karsten Hopp 3dd886
   * when using a dynamic scrollbar policy.
Karsten Hopp 3dd886
***************
Karsten Hopp 3dd886
*** 633,648 ****
Karsten Hopp 3dd886
  	data->sel[which] = XtNewString(sel);
Karsten Hopp 3dd886
      else
Karsten Hopp 3dd886
      {
Karsten Hopp 3dd886
- 	XtFree(data->sel[which]);
Karsten Hopp 3dd886
  	if (!strcmp(data->sel[which], sel))
Karsten Hopp 3dd886
  	{
Karsten Hopp 3dd886
  	    /* unselecting current selection */
Karsten Hopp 3dd886
  	    data->sel[which] = NULL;
Karsten Hopp 3dd886
  	    if (w)
Karsten Hopp 3dd886
  		XmListDeselectItem(w, call_data->item);
Karsten Hopp 3dd886
  	}
Karsten Hopp 3dd886
  	else
Karsten Hopp 3dd886
  	    data->sel[which] = XtNewString(sel);
Karsten Hopp 3dd886
      }
Karsten Hopp 3dd886
      XtFree(sel);
Karsten Hopp 3dd886
  
Karsten Hopp 3dd886
--- 633,651 ----
Karsten Hopp 3dd886
  	data->sel[which] = XtNewString(sel);
Karsten Hopp 3dd886
      else
Karsten Hopp 3dd886
      {
Karsten Hopp 3dd886
  	if (!strcmp(data->sel[which], sel))
Karsten Hopp 3dd886
  	{
Karsten Hopp 3dd886
  	    /* unselecting current selection */
Karsten Hopp 3dd886
+ 	    XtFree(data->sel[which]);
Karsten Hopp 3dd886
  	    data->sel[which] = NULL;
Karsten Hopp 3dd886
  	    if (w)
Karsten Hopp 3dd886
  		XmListDeselectItem(w, call_data->item);
Karsten Hopp 3dd886
  	}
Karsten Hopp 3dd886
  	else
Karsten Hopp 3dd886
+ 	{
Karsten Hopp 3dd886
+ 	    XtFree(data->sel[which]);
Karsten Hopp 3dd886
  	    data->sel[which] = XtNewString(sel);
Karsten Hopp 3dd886
+ 	}
Karsten Hopp 3dd886
      }
Karsten Hopp 3dd886
      XtFree(sel);
Karsten Hopp 3dd886
  
Karsten Hopp 3dd886
*** ../vim-7.2.270/src/version.c	2009-11-03 12:38:50.000000000 +0100
Karsten Hopp 3dd886
--- src/version.c	2009-11-03 12:48:26.000000000 +0100
Karsten Hopp 3dd886
***************
Karsten Hopp 3dd886
*** 678,679 ****
Karsten Hopp 3dd886
--- 678,681 ----
Karsten Hopp 3dd886
  {   /* Add new patch number below this line */
Karsten Hopp 3dd886
+ /**/
Karsten Hopp 3dd886
+     271,
Karsten Hopp 3dd886
  /**/
Karsten Hopp 3dd886
Karsten Hopp 3dd886
-- 
Karsten Hopp 3dd886
ROBIN:  (warily) And if you get a question wrong?
Karsten Hopp 3dd886
ARTHUR: You are cast into the Gorge of Eternal Peril.
Karsten Hopp 3dd886
ROBIN:  Oh ... wacho!
Karsten Hopp 3dd886
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 3dd886
Karsten Hopp 3dd886
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 3dd886
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 3dd886
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 3dd886
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///