unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>
Cc: 17510@debbugs.gnu.org, dmantipov@yandex.ru
Subject: bug#17510: 24.3.91; Problem with `emacs --daemon' in cygw32 build
Date: Sat, 24 May 2014 15:59:07 +0300	[thread overview]
Message-ID: <83sinzjpt0.fsf@gnu.org> (raw)
In-Reply-To: <538092B6.9000807@cornell.edu>

> Date: Sat, 24 May 2014 08:38:14 -0400
> From: Ken Brown <kbrown@cornell.edu>
> CC: 17510@debbugs.gnu.org, dmantipov@yandex.ru
> 
> My guess as to the cause of this bug was completely wrong.  What happens 
> in my recipe is that the pointer dpyinfo->w32_id_name is freed twice. 
> (This is done in x_delete_display each time the only existing client 
> frame is deleted.)  An attempt to create a client frame for the third 
> time then leads to a crash because of malloc corruption.
> 
> I have no idea why this problem only showed up after Dmitry's code 
> cleanup.  The only thing I can think of is that maintaining a list of 
> display names, with insertions and deletions, masked the malloc corruption.
> 
> I think the right fix here would be to really delete the display when 
> x_delete_display is called, free all resources, and set things up so 
> that everything will be re-initialized if a new frame is created.  But 
> this seems like a lot of trouble, possibly with unintended consequences. 
>   The following is a much simpler workaround:
> 
> === modified file 'src/w32term.c'
> --- src/w32term.c       2014-04-16 14:00:39 +0000
> +++ src/w32term.c       2014-05-24 12:13:15 +0000
> @@ -6426,7 +6426,9 @@
>       if (dpyinfo->palette)
>         DeleteObject (dpyinfo->palette);
>     }
> +#ifndef CYGWIN
>     xfree (dpyinfo->w32_id_name);
> +#endif
> 
>     w32_reset_fringes ();
>   }
> 
> I would of course add a comment explaining this.  What do you think?

This looks OK to me, but I wonder: is it really correct not to free
w32_id_name at all?  And if that is correct, why only on Cygwin?

Does the Cygwin-w32 build also use a single dpyinfo object, like the
native Windows build?  If so, perhaps we need not free this in both
these builds.  IOW, I think your suggested change is OK for the
emacs-24 branch, but on the trunk I'd suggest to remove the xfree line
altogether.

Thanks.





  reply	other threads:[~2014-05-24 12:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 17:50 bug#17510: 24.3.91; Problem with `emacs --daemon' in cygw32 build Ken Brown
2014-05-16 20:06 ` Ken Brown
2014-05-17 23:39   ` Ken Brown
2014-05-18  4:32     ` Eli Zaretskii
2014-05-18 14:30       ` Ken Brown
2014-05-18 15:11         ` Eli Zaretskii
2014-05-18 19:36           ` Ken Brown
2014-05-19 12:03             ` Ken Brown
2014-05-19 16:46             ` Eli Zaretskii
2014-05-19 17:31               ` Eli Zaretskii
2014-05-19 19:25               ` Ken Brown
2014-05-24 12:38                 ` Ken Brown
2014-05-24 12:59                   ` Eli Zaretskii [this message]
2014-05-24 18:14                     ` Ken Brown
2014-05-24 22:18                       ` Ken Brown
2014-05-24 19:28                   ` Daniel Colascione
2014-05-24 22:18                     ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sinzjpt0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17510@debbugs.gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=kbrown@cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).