all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: 70311@debbugs.gnu.org, gregsexton@gmail.com
Subject: bug#70311: Crash when dnd-indicate-insertion-point is non-nil
Date: Sat, 13 Apr 2024 19:00:57 +0300	[thread overview]
Message-ID: <86ttk5ntfq.fsf@gnu.org> (raw)
In-Reply-To: <878r1h30rl.fsf@yahoo.com> (message from Po Lu on Sat, 13 Apr 2024 20:28:14 +0800)

> From: Po Lu <luangruo@yahoo.com>
> Cc: gregsexton@gmail.com,  70311@debbugs.gnu.org
> Date: Sat, 13 Apr 2024 20:28:14 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > So you think the suggested band-aid is the best we can currently do to
> > prevent crashes in those cases?
> 
> Yes, unfortunately.

Does the band-aid below look OK to you?

diff --git a/lisp/dnd.el b/lisp/dnd.el
index 89652d3..de1c58a 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -149,8 +149,13 @@ dnd-handle-movement
                 (with-selected-window window
                   (scroll-down 1))))))))
       (when dnd-indicate-insertion-point
-        (ignore-errors
-          (goto-char (posn-point posn)))))))
+        (let ((pos (posn-point posn)))
+          ;; We avoid errors here, since on some systems this runs
+          ;; when waiting_for_input is non-zero, and that aborts on
+          ;; error.
+          (if (and pos (<= (point-min) pos (point-max)))
+              (goto-char pos)
+            pos))))))
 
 (defun dnd-handle-one-url (window action url)
   "Handle one dropped url by calling the appropriate handler.





  reply	other threads:[~2024-04-13 16:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 10:26 bug#70311: Crash when dnd-indicate-insertion-point is non-nil Greg Sexton
2024-04-13  9:20 ` Eli Zaretskii
2024-04-13 11:58   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13 12:06     ` Eli Zaretskii
2024-04-13 12:28       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13 16:00         ` Eli Zaretskii [this message]
2024-04-14  9:24           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-14 10:17             ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=86ttk5ntfq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70311@debbugs.gnu.org \
    --cc=gregsexton@gmail.com \
    --cc=luangruo@yahoo.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.