Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing "# C-g" in *Ediff Control Panel*" causes Emacs to freeze and leak memory #317

Closed
shitikanth opened this issue Jul 26, 2021 · 3 comments

Comments

@shitikanth
Copy link

shitikanth commented Jul 26, 2021

Steps to reproduce:

  1. Start emacs with emacs -Q -L $which-key-srcdir -l bug.el (just loads which-key and starts ediff on two empty buffers).
  2. Press # C-g. (Sometimes it takes a couple of tries before it crashes,)
;;; bug.el
(require 'which-key)
(which-key-mode)

(let ((buf-a (generate-new-buffer "temp"))
      (buf-b (generate-new-buffer "temp")))
  (ediff-buffers buf-a buf-b))

Lisp backtrace from gdb:

(gdb) xbacktrace 
"format" (0xffffade0)
"seq-subseq" (0xffffb168)
"cl-subseq" (0xffffb3c0)
"cons" (0xffffb4f0)
"setq" (0xffffb5c0)
"while" (0xffffb690)
"let" (0xffffb7a0)
"which-key--partition-list" (0xffffb890)
"mapcar" (0xffffb9c0)
"let" (0xffffbb20)
"which-key--list-to-pages" (0xffffbc10)
"let" (0xffffbdd0)
"which-key--create-pages-1" (0xffffbec0)
"setq" (0xffffc030)
"let*" (0xffffc120)
"which-key--create-pages" (0xffffc210)
"setq" (0xffffc370)
"cond" (0xffffc430)
"let" (0xffffc550)
"which-key--create-buffer-and-show" (0xffffc640)
"progn" (0xffffc770)
"if" (0xffffc810)
"cond" (0xffffc8d0)
"let" (0xffffc9f0)
"which-key--update" (0xffffcc30)
"apply" (0xffffcc28)
"timer-event-handler" (0xffffcfa8)
@shitikanth
Copy link
Author

Found the issue: in the default gui setup, ediff control panel lives in a tiny frame of height of 1 line where (which-key--popup-max-dimensions) returns (0 . 12) and which-key then tries to partition the results into groups of zero.

Possible fixes:

  1. We could show the completion in the other frame. This is where the minibuffer lives and this will be consistent with how M-x, M-: etc behave in the ediff control panel.
  2. We could just not show anything at all when number of rows is 0.

shitikanth pushed a commit to shitikanth/emacs-which-key that referenced this issue Jul 26, 2021
@shitikanth
Copy link
Author

@justbur any feedback on this?

@justbur justbur closed this as completed in 4d20bc8 Sep 5, 2023
@justbur
Copy link
Owner

justbur commented Sep 5, 2023

Sorry for the delay.

Thank you for the report and the diagnosis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants