Dominique Pelle wrote:

> On Sat, Jun 7, 2008 at 8:44 AM, Dominique Pelle wrote:
> 
> > Attached:
> > - crash-os_unix.c.patch
> > - leak-os_unix.c.patch
> 
> I built the gui-motif, gui-athena and gui-gtk2 on Linux x86 and the crash in
> os_unix.c only happens with gui-motif (I'm using LessTif).
> 
> So instead of doing #if 0 as in my previous patch, it should be better to
> do #ifndef FEAT_GUI_MOTIF.
> 
> gui-athena shows errors with -DEXITFREE just a few lines below though:
> 
> ==15738== Invalid read of size 4
> ==15738==    at 0x42CDEE7: XCloseDisplay (in /usr/lib/libX11.so.6.2.0)
> ==15738==    by 0x8140419: mch_free_mem (os_unix.c:2900)
> ==15738==    by 0x810A969: free_all_mem (misc2.c:1125)
> ==15738==    by 0x8140573: mch_exit (os_unix.c:3012)
> ==15738==    by 0x80DE4C8: getout (main.c:1342)
> ==15738==    by 0x80A56C3: ex_quit_all (ex_docmd.c:6281)
> ==15738==    by 0x809F8CB: do_one_cmd (ex_docmd.c:2623)
> ==15738==    by 0x809D18C: do_cmdline (ex_docmd.c:1099)
> ==15738==    by 0x812030E: nv_colon (normal.c:5179)
> ==15738==    by 0x8119B88: normal_cmd (normal.c:1152)
> ==15738==    by 0x80DE20A: main_loop (main.c:1181)
> ==15738==    by 0x80DDD5A: main (main.c:940)
> ==15738==  Address 0x44020cc is 148 bytes inside a block of size 1,340 free'd
> ==15738==    at 0x402265C: free (vg_replace_malloc.c:323)
> ==15738==    by 0x42E0F3E: _XFreeDisplayStructure (in 
> /usr/lib/libX11.so.6.2.0)
> ==15738==    by 0x42CDFC5: XCloseDisplay (in /usr/lib/libX11.so.6.2.0)
> ==15738==    by 0x424EC49: (within /usr/lib/libXt.so.6.0.0)
> ==15738==    by 0x424EE36: XtCloseDisplay (in /usr/lib/libXt.so.6.0.0)
> ==15738==    by 0x424EE70: (within /usr/lib/libXt.so.6.0.0)
> ==15738==    by 0x424F164: XtDestroyApplicationContext (in
> /usr/lib/libXt.so.6.0.0)
> ==15738==    by 0x81403F4: mch_free_mem (os_unix.c:2896)
> ==15738==    by 0x810A969: free_all_mem (misc2.c:1125)
> ==15738==    by 0x8140573: mch_exit (os_unix.c:3012)
> ==15738==    by 0x80DE4C8: getout (main.c:1342)
> ==15738==    by 0x80A56C3: ex_quit_all (ex_docmd.c:6281)
> ==15738==    by 0x809F8CB: do_one_cmd (ex_docmd.c:2623)
> ==15738==    by 0x809D18C: do_cmdline (ex_docmd.c:1099)
> ==15738==    by 0x812030E: nv_colon (normal.c:5179)
> ==15738==    by 0x8119B88: normal_cmd (normal.c:1152)
> ==15738==    by 0x80DE20A: main_loop (main.c:1181)
> ==15738==    by 0x80DDD5A: main (main.c:940)
> 
> os_unix.c:
> 
>   2890 # if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)) || defined(PROTO)
>   2891     if (xterm_Shell != (Widget)0)
>   2892         XtDestroyWidget(xterm_Shell);
>   2893     if (xterm_dpy != NULL)
>   2894         XtCloseDisplay(xterm_dpy);
>   2895     if (app_context != (XtAppContext)NULL)
> !! 2896         XtDestroyApplicationContext(app_context);
>   2897 # endif
>   2898 # ifdef FEAT_X11
>   2899     if (x11_display != NULL && x11_display != xterm_dpy)
> !! 2900         XCloseDisplay(x11_display);
>   2901 # endif
> 
> Line 2900 is using memory which was freed at line 2896
> according to valgrind. So it seems that
> XtDestroyApplicationContext(app_context) is also
> destroying x11_display.
> 
> Attached patch fixes the error.

Thanks.  I wonder if we can use #ifndef LESSTIF_VERSION  instead of
FEAT_GUI_MOTIF.  The other "#if 0" suggests that Solaris also has this
problem.  But I'm not sure about this specific code, since it was added
much later.

-- 
Me?  A skeptic?  I trust you have proof.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- 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    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui