unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [drew.adams@oracle.com: RE: weird defadvice bug with byte-compilation]
Date: Sun, 11 Dec 2005 22:21:29 +0200	[thread overview]
Message-ID: <uslsz9ygm.fsf@gnu.org> (raw)
In-Reply-To: <ur78mjtpp.fsf@gnu.org> (message from Eli Zaretskii on Fri, 09 Dec 2005 15:17:06 +0200)

> Date: Fri, 09 Dec 2005 15:17:06 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: Chong Yidong <cyd@stupidchicken.com>, emacs-devel@gnu.org
> 
>     Lisp Backtrace:
>     "kill-emacs"
>     "save-buffers-kill-emacs"
>     "call-interactively"
>     "recursive-edit"
>     "byte-code"
>     "debug"
>     "and"
>     "x-create-frame"
>     "x-create-frame-with-faces"
>     "make-frame"
>     "special-display-popup-frame"
>     "display-buffer"
>     "display-warning"
>     "byte-compile-log-warning"
>     "byte-compile-warn"
> 
> I will try to debug this when I have time (any ideas are welcome), but
> in the meantime, I see already that the problem that causes Emacs to
> commit suicide in frame #2 is that glyph_matrix_count is 8 instead of
> 0.  Here's the code of check_glyph_memory:
> 
>     /* Check glyph memory leaks.  This function is called from
>        shut_down_emacs.  Note that frames are not destroyed when Emacs
>        exits.  We therefore free all glyph memory for all active frames
>        explicitly and check that nothing is left allocated.  */
> 
>     void
>     check_glyph_memory ()
>     {
>       Lisp_Object tail, frame;
> 
>       /* Free glyph memory for all frames.  */
>       FOR_EACH_FRAME (tail, frame)
> 	free_glyphs (XFRAME (frame));
> 
>       /* Check that nothing is left allocated.  */
>       if (glyph_matrix_count)
> 	abort ();
>       if (glyph_pool_count)
> 	abort ();
>     }
> 
> It sounds like some frame's glyph matrices were not freed for some
> reason?

I did some debugging.  I do not yet have all the answers, but the fog
is beginning to clear.

First, I think that a Unix or GNU/Linux build on X, but without any
toolkits (no GTK, no Motif/Lesstiff, no Xt), might hit this bug as
well.  Can someone please try that?  I cannot easily build and test
such a version on GNU boxes to which I have access.

Second, the crash is somehow related to the fact that x-create-frame
is called from within itself, or something like that: When advice
byte-compiles the advised function on the fly, it hits the problem
with the unbound variable, and wants to display a warning in the
*Compile-Log* buffer.  However, due to this line from bar.el:

    (defconst special-display-regexps '("[ ]?[*][^*]+[*]"))

*Compile-Log* is one of the buffers that need a separate frame, so
Emacs begins to create a frame.  During that frame's creation, it
hits the problem with the void variable again, and wants to display
the backtrace, but the *Backtrace* buffer also needs a separate
frame...

Here's the relevant portion of the Lisp backtrace:

    Debugger entered--Lisp error: (void-variable my-mode)
      (and my-mode)
      x-create-frame(((visibility) (height . 14) (width . 80) (unsplittable . t)))
      x-create-frame-with-faces(((height . 14) (width . 80) (unsplittable . t)))
      make-frame(((height . 14) (width . 80) (unsplittable . t)))
      special-display-popup-frame(#<buffer *Compile-Log*>)
      display-buffer(#<buffer *Compile-Log*>)
      display-warning(bytecomp "reference to free variable `my-mode'" :warning "*Compile-Log*")
      byte-compile-log-warning("reference to free variable `my-mode'" t :warning)
      byte-compile-warn("reference to free variable `%s'" my-mode)
      byte-compile-variable-ref(byte-varref my-mode)
      byte-compile-form(my-mode t)
      byte-compile-body(((setq ad-return-value (ad-Orig-next-history-element n)) my-mode ad-return-value) nil)

When the frame displaying *Backtrace* pops up, the variable
Vframe_list does not yet include the frame that was partly created to
display *Compile-Log*, so check_glyph_memory does not free that
frame's glyph matrices.

Does this make sense?

  parent reply	other threads:[~2005-12-11 20:21 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05  2:36 [drew.adams@oracle.com: RE: weird defadvice bug with byte-compilation] Richard Stallman
2005-12-07 18:55 ` Chong Yidong
2005-12-08  4:53   ` Richard M. Stallman
2005-12-08 16:14     ` Drew Adams
2005-12-09 13:17       ` Eli Zaretskii
2005-12-09 14:07         ` Chong Yidong
2005-12-09 18:37         ` [drew.adams@oracle.com: RE: weird defadvice bug withbyte-compilation] Drew Adams
2005-12-10  4:14         ` [drew.adams@oracle.com: RE: weird defadvice bug with byte-compilation] Richard M. Stallman
2005-12-11 18:17           ` [drew.adams@oracle.com: RE: weird defadvice bug withbyte-compilation] Drew Adams
2005-12-12  5:23             ` Richard M. Stallman
2005-12-12  5:40               ` [drew.adams@oracle.com: RE: weird defadvice bugwithbyte-compilation] Drew Adams
2005-12-13  3:14                 ` Richard M. Stallman
2005-12-13  3:52                   ` [drew.adams@oracle.com: RE: weird defadvicebugwithbyte-compilation] Drew Adams
2005-12-13 23:33                     ` Richard M. Stallman
2005-12-14  1:05                       ` [drew.adams@oracle.com: RE: weirddefadvicebugwithbyte-compilation] Drew Adams
2005-12-14  1:24                         ` Johan Bockgård
2005-12-14  3:41                           ` [drew.adams@oracle.com: Drew Adams
2005-12-14  3:45                             ` [drew.adams@oracle.com:RE:weirddefadvicebugwithbyte-compilation] Drew Adams
2005-12-14 17:17                             ` [drew.adams@oracle.com: Johan Bockgård
2005-12-14 21:29                               ` [drew.adams@oracle.com:RE:weirddefadvicebugwithbyte-compilation] Drew Adams
2005-12-14 23:43                                 ` [drew.adams@oracle.com:RE:weirddefadvicebugwithbyte-compilation] Johan Bockgård
2005-12-15  1:46                                   ` [drew.adams@oracle.com:RE:weirddefadvicebugwithbyte-compilation] Drew Adams
2005-12-11 20:21         ` Eli Zaretskii [this message]
2005-12-11 21:35           ` [drew.adams@oracle.com: RE: weird defadvice bug withbyte-compilation] Drew Adams
2005-12-12  5:52             ` Eli Zaretskii
2005-12-12  6:11               ` [drew.adams@oracle.com: RE: weird defadvice bugwithbyte-compilation] Drew Adams
2005-12-12  6:44                 ` [drew.adams@oracle.com: RE: weird defadvicebugwithbyte-compilation] Drew Adams
2005-12-12 21:22                   ` Eli Zaretskii
2005-12-12 21:53                     ` [drew.adams@oracle.com: RE: weirddefadvicebugwithbyte-compilation] Drew Adams
2005-12-13  4:30                       ` Eli Zaretskii
2005-12-13  4:59                         ` [drew.adams@oracle.com: Drew Adams
2005-12-12  5:23           ` [drew.adams@oracle.com: RE: weird defadvice bug with byte-compilation] Richard M. Stallman
2005-12-12  6:11             ` Eli Zaretskii
2005-12-13  3:14               ` Richard M. Stallman
2005-12-13  4:39                 ` Eli Zaretskii
2005-12-13 23:33                   ` Richard M. Stallman
2005-12-14 19:38                     ` Eli Zaretskii
2005-12-15  2:09                       ` Richard M. Stallman
2005-12-15  4:46                         ` Eli Zaretskii
2005-12-16  1:51                           ` Richard M. Stallman
2005-12-16 19:48                             ` Eli Zaretskii
2005-12-16 20:14                             ` Eli Zaretskii
2005-12-17  1:05                               ` Richard M. Stallman
2005-12-17  8:29                                 ` Eli Zaretskii
2005-12-17 23:59                                   ` Richard M. Stallman
  -- strict thread matches above, loose matches on Subject: below --
2005-11-28  4:46 Richard M. Stallman

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=uslsz9ygm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).