To: vim-dev@vim.org
Subject: Patch 7.1.318
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 7.1.318
Problem: Memory leak when closing xsmp connection. Crash on exit when
using Lesstif.
Solution: Don't close the X display to work around a Lesstif bug. Free
clientid. Also fix a leak for Motif and Athena. (Dominique Pelle)
Files: src/gui_x11.c, src/os_unix.c
*** ../vim-7.1.317/src/gui_x11.c Thu May 10 21:11:45 2007
--- src/gui_x11.c Sun Jun 8 17:13:45 2008
***************
*** 1538,1545 ****
--- 1538,1548 ----
attr.depth = DefaultDepthOfScreen(scr);
if (!icon)
+ {
XpmCreatePixmapFromData(dsp, root_window, magick, &icon,
&icon_mask, &attr);
+ XpmFreeAttributes(&attr);
+ }
# ifdef FEAT_GUI_ATHENA
XtVaSetValues(vimShell, XtNiconPixmap, icon, XtNiconMask, icon_mask, NULL);
*** ../vim-7.1.317/src/os_unix.c Wed May 7 19:05:55 2008
--- src/os_unix.c Tue Jun 17 21:03:54 2008
***************
*** 209,214 ****
--- 209,215 ----
{
SmcConn smcconn; /* The SM connection ID */
IceConn iceconn; /* The ICE connection ID */
+ char *clientid; /* The client ID for the current smc session */
Bool save_yourself; /* If we're in the middle of a save_yourself */
Bool shutdown; /* If we're in shutdown mode */
} xsmp_config_T;
***************
*** 2887,2902 ****
if (clip_plus.owned)
clip_lose_selection(&clip_plus);
# endif
! # if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)) || defined(PROTO)
if (xterm_Shell != (Widget)0)
XtDestroyWidget(xterm_Shell);
if (xterm_dpy != NULL)
XtCloseDisplay(xterm_dpy);
if (app_context != (XtAppContext)NULL)
XtDestroyApplicationContext(app_context);
# endif
# ifdef FEAT_X11
! if (x11_display != NULL && x11_display != xterm_dpy)
XCloseDisplay(x11_display);
# endif
# if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
--- 2893,2920 ----
if (clip_plus.owned)
clip_lose_selection(&clip_plus);
# endif
! # if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
if (xterm_Shell != (Widget)0)
XtDestroyWidget(xterm_Shell);
+ # ifndef LESSTIF_VERSION
+ /* Lesstif crashes here, lose some memory */
if (xterm_dpy != NULL)
XtCloseDisplay(xterm_dpy);
if (app_context != (XtAppContext)NULL)
+ {
XtDestroyApplicationContext(app_context);
+ # ifdef FEAT_X11
+ x11_display = NULL; /* freed by XtDestroyApplicationContext() */
+ # endif
+ }
+ # endif
# endif
# ifdef FEAT_X11
! if (x11_display != NULL
! # ifdef FEAT_XCLIPBOARD
! && x11_display != xterm_dpy
! # endif
! )
XCloseDisplay(x11_display);
# endif
# if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
***************
*** 6290,6311 ****
}
if (xterm_dpy != NULL)
{
! #if 0
/* Lesstif and Solaris crash here, lose some memory */
XtCloseDisplay(xterm_dpy);
! #endif
if (x11_display == xterm_dpy)
x11_display = NULL;
xterm_dpy = NULL;
}
! #if 0
if (app_context != (XtAppContext)NULL)
{
/* Lesstif and Solaris crash here, lose some memory */
XtDestroyApplicationContext(app_context);
app_context = (XtAppContext)NULL;
}
! #endif
}
# endif
--- 6308,6329 ----
}
if (xterm_dpy != NULL)
{
! # if 0
/* Lesstif and Solaris crash here, lose some memory */
XtCloseDisplay(xterm_dpy);
! # endif
if (x11_display == xterm_dpy)
x11_display = NULL;
xterm_dpy = NULL;
}
! # if 0
if (app_context != (XtAppContext)NULL)
{
/* Lesstif and Solaris crash here, lose some memory */
XtDestroyApplicationContext(app_context);
app_context = (XtAppContext)NULL;
}
! # endif
}
# endif
***************
*** 6557,6563 ****
xsmp_init(void)
{
char errorstring[80];
- char *clientid;
SmcCallbacks smcallbacks;
#if 0
SmPropValue smname;
--- 6575,6580 ----
***************
*** 6599,6605 ****
| SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask,
&smcallbacks,
NULL,
! &clientid,
sizeof(errorstring),
errorstring);
if (xsmp.smcconn == NULL)
--- 6616,6622 ----
| SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask,
&smcallbacks,
NULL,
! &xsmp.clientid,
sizeof(errorstring),
errorstring);
if (xsmp.smcconn == NULL)
***************
*** 6638,6643 ****
--- 6655,6662 ----
if (xsmp_icefd != -1)
{
SmcCloseConnection(xsmp.smcconn, 0, NULL);
+ vim_free(xsmp.clientid);
+ xsmp.clientid = NULL;
xsmp_icefd = -1;
}
}
*** ../vim-7.1.317/src/version.c Fri Jun 20 11:39:04 2008
--- src/version.c Fri Jun 20 11:56:09 2008
***************
*** 668,669 ****
--- 673,676 ----
{ /* Add new patch number below this line */
+ /**/
+ 318,
/**/
--
hundred-and-one symptoms of being an internet addict:
44. Your friends no longer send you e-mail...they just log on to your IRC
channel.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///