4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Memory leak when closing xsmp connection. Crash on exit when
13 Solution: Don't close the X display to work around a Lesstif bug. Free
14 clientid. Also fix a leak for Motif and Athena. (Dominique Pelle)
15 Files: src/gui_x11.c, src/os_unix.c
18 *** ../vim-7.1.317/src/gui_x11.c Thu May 10 21:11:45 2007
19 --- src/gui_x11.c Sun Jun 8 17:13:45 2008
23 attr.depth = DefaultDepthOfScreen(scr);
27 XpmCreatePixmapFromData(dsp, root_window, magick, &icon,
29 + XpmFreeAttributes(&attr);
32 # ifdef FEAT_GUI_ATHENA
33 XtVaSetValues(vimShell, XtNiconPixmap, icon, XtNiconMask, icon_mask, NULL);
34 *** ../vim-7.1.317/src/os_unix.c Wed May 7 19:05:55 2008
35 --- src/os_unix.c Tue Jun 17 21:03:54 2008
40 SmcConn smcconn; /* The SM connection ID */
41 IceConn iceconn; /* The ICE connection ID */
42 + char *clientid; /* The client ID for the current smc session */
43 Bool save_yourself; /* If we're in the middle of a save_yourself */
44 Bool shutdown; /* If we're in shutdown mode */
49 clip_lose_selection(&clip_plus);
51 ! # if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)) || defined(PROTO)
52 if (xterm_Shell != (Widget)0)
53 XtDestroyWidget(xterm_Shell);
54 if (xterm_dpy != NULL)
55 XtCloseDisplay(xterm_dpy);
56 if (app_context != (XtAppContext)NULL)
57 XtDestroyApplicationContext(app_context);
60 ! if (x11_display != NULL && x11_display != xterm_dpy)
61 XCloseDisplay(x11_display);
63 # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
66 clip_lose_selection(&clip_plus);
68 ! # if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
69 if (xterm_Shell != (Widget)0)
70 XtDestroyWidget(xterm_Shell);
71 + # ifndef LESSTIF_VERSION
72 + /* Lesstif crashes here, lose some memory */
73 if (xterm_dpy != NULL)
74 XtCloseDisplay(xterm_dpy);
75 if (app_context != (XtAppContext)NULL)
77 XtDestroyApplicationContext(app_context);
79 + x11_display = NULL; /* freed by XtDestroyApplicationContext() */
85 ! if (x11_display != NULL
86 ! # ifdef FEAT_XCLIPBOARD
87 ! && x11_display != xterm_dpy
90 XCloseDisplay(x11_display);
92 # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
96 if (xterm_dpy != NULL)
99 /* Lesstif and Solaris crash here, lose some memory */
100 XtCloseDisplay(xterm_dpy);
102 if (x11_display == xterm_dpy)
107 if (app_context != (XtAppContext)NULL)
109 /* Lesstif and Solaris crash here, lose some memory */
110 XtDestroyApplicationContext(app_context);
111 app_context = (XtAppContext)NULL;
119 if (xterm_dpy != NULL)
122 /* Lesstif and Solaris crash here, lose some memory */
123 XtCloseDisplay(xterm_dpy);
125 if (x11_display == xterm_dpy)
130 if (app_context != (XtAppContext)NULL)
132 /* Lesstif and Solaris crash here, lose some memory */
133 XtDestroyApplicationContext(app_context);
134 app_context = (XtAppContext)NULL;
144 char errorstring[80];
146 SmcCallbacks smcallbacks;
152 | SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask,
158 if (xsmp.smcconn == NULL)
160 | SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask,
166 if (xsmp.smcconn == NULL)
170 if (xsmp_icefd != -1)
172 SmcCloseConnection(xsmp.smcconn, 0, NULL);
173 + vim_free(xsmp.clientid);
174 + xsmp.clientid = NULL;
178 *** ../vim-7.1.317/src/version.c Fri Jun 20 11:39:04 2008
179 --- src/version.c Fri Jun 20 11:56:09 2008
183 { /* Add new patch number below this line */
189 hundred-and-one symptoms of being an internet addict:
190 44. Your friends no longer send you e-mail...they just log on to your IRC
193 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
194 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
195 \\\ download, build and distribute -- http://www.A-A-P.org ///
196 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///