From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Jason Rumney <jasonr@f2s.com>
Cc: Magnus Henoch <mange@freemail.hr>, 716@emacsbugs.donarmstrong.com
Subject: bug#716: Bug in buffer-swap-text
Date: Tue, 23 Dec 2008 12:23:54 -0500 [thread overview]
Message-ID: <jwv4p0u24yy.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <49510053.6020805@f2s.com> (Jason Rumney's message of "Tue, 23 Dec 2008 23:14:27 +0800")
>>> One possible variable here is the way that buffer space is allocated. On
>>> Windows, it seems REL_ALLOC is defined. I presume GNU/Linux defines
>>> USE_MMAP_FOR_BUFFERS which would cause it to take a different code path
>>> around the point where we see a crash on Windows, and as Magnus Henoch
>>> saw on NetBSD/powerpc also (though we don't have a stack trace for that
>>> crash, so can't tell for sure it is crashing in the same place).
>> The following patch seems to fix the problem, does it look correct to
>> others who might understand ralloc.c and buffer_swap_text better than
>> I do?
> Sorry, once more with context:
Your analysis sounds right, thank you. I'd suggest to use another
r_alloc primitve, something like r_alloc_reset_variable, so you could do
r_alloc_reset_variable(¤t_buffer->own_text.beg);
r_alloc_reset_variable(&other_buffer->own_text.beg);
after the swap. It could use the untested patch below. WDYT?
Stefan
=== modified file 'src/ralloc.c'
--- src/ralloc.c 2008-11-21 19:14:07 +0000
+++ src/ralloc.c 2008-12-23 17:23:02 +0000
@@ -402,7 +402,7 @@
while (p != NIL_BLOC)
{
- if (p->variable == ptr && p->data == *ptr)
+ if (p->data == *ptr)
return p;
p = p->next;
@@ -1223,6 +1223,15 @@
#endif /* DEBUG */
+/* Change the variable of the bloc pointed from `p' to be `p'. */
+void r_alloc_reset_variable (POINTER *p)
+{
+ bloc_ptr bloc = find_bloc (p);
+ if (bloc == NIL_BLOC)
+ abort ();
+ bloc->variable = p;
+}
+
\f
/***********************************************************************
next prev parent reply other threads:[~2008-12-23 17:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-08 10:41 bug#716: Bug in buffer-swap-text Geoff Gole
2008-11-08 12:51 ` Magnus Henoch
2008-12-02 22:58 ` Stefan Monnier
2008-12-03 0:11 ` jasonr
2008-12-03 2:44 ` Stefan Monnier
2008-12-03 2:55 ` jasonr
2008-12-23 12:45 ` Jason Rumney
2008-12-23 14:51 ` Jason Rumney
2008-12-23 15:14 ` Jason Rumney
2008-12-23 17:23 ` Stefan Monnier [this message]
2008-12-23 23:15 ` Jason Rumney
2008-12-24 1:17 ` jasonr
2008-12-24 2:41 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2008-12-03 15:25 Geoff Gole
2008-12-03 15:42 ` Jason Rumney
2008-12-03 15:46 ` Geoff Gole
2008-12-03 20:42 ` Stefan Monnier
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=jwv4p0u24yy.fsf-monnier+emacsbugreports@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=716@emacsbugs.donarmstrong.com \
--cc=jasonr@f2s.com \
--cc=mange@freemail.hr \
/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).