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

Latest update leads to crash on mac os gui #41

Closed
articuluxe opened this issue Jan 22, 2024 · 4 comments
Closed

Latest update leads to crash on mac os gui #41

articuluxe opened this issue Jan 22, 2024 · 4 comments

Comments

@articuluxe
Copy link

I run emacs 29.2 on 2 macs: one running Sonoma 14.2.1, the other Monterey 12.7.2. On both these machines (but not my Linux machine), after updating to the latest page-break-lines (commit e8bfd1a), and launching the emacs server, I would get crashes soon after launching the client frame to connect to the server.

The stack trace showed

EXC_BAD_ACCESS (SIGABRT)
in
QuartzCore: CA::Layer::property_did_change(CA::Transaction*, unsigned int) + 4171

There was also the following error:

page-break-lines--update-display-tables: Arithmetic error during redisplay: signaled (arith-error) [2 times]

After reverting that commit the behavior went away immediately.

I hope this helps someone track down this issue if it happens to them.

@purcell
Copy link
Owner

purcell commented Jan 23, 2024

Thanks for reporting this. That's quite a weird issue, and sounds like an Emacs bug tbh. I'm on the same macOS version but with 29.1, and haven't had any issues, though I don't usually run Emacs in server/client: I just tried it now, both with terminal and GUI frames without issue. What Emacs build do you have? (Homebrew? Railwaycat? Emacsformacosx etc.)

The arith-error suggests that (string-pixel-width (make-string 100 ?a)) is returning zero somewhere — could you try evaluating it in a client frame, or set debug-on-error to t and see if you can get a backtrace?

I'm happy to commit a workaround or revert the commit but it'd be nice to learn more about what's going on.

@purcell
Copy link
Owner

purcell commented Jan 31, 2024

I repeated my test with Emacs 29.2 btw, and still can't reproduce the issue. So answers to the questions above would help.

@toinfty
Copy link

toinfty commented Feb 6, 2024

I have this issue too. The reason is that the following code segment at https://github.com/purcell/page-break-lines/blob/e8bfd1ab660030679163f5a4913ff24b99095436/page-break-lines.el#L129C46-L130C92 returns 0.

(/ (string-pixel-width (make-string 100 page-break-lines-char)) ;; return 1200 using my config
    (string-pixel-width (make-string 100 ?a)));; return 1300 using my config

Changing it to

(/ (float (string-pixel-width (make-string 100 page-break-lines-char)))
   (string-pixel-width (make-string 100 ?a)))

fixes my issue.

@purcell
Copy link
Owner

purcell commented Feb 6, 2024

Aha! Thanks for providing the detailed info. I had missed that this was integer division, since for me the two widths are the same. This is much less of a mystery, and I'll commit your fix immediately.

@purcell purcell closed this as completed in 1b85352 Feb 6, 2024
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

3 participants