all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jason Rumney <jasonr@f2s.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Magnus Henoch <mange@freemail.hr>, 716@emacsbugs.donarmstrong.com
Subject: bug#716: Bug in buffer-swap-text
Date: Tue, 23 Dec 2008 22:51:34 +0800	[thread overview]
Message-ID: <4950FAF6.808@f2s.com> (raw)
In-Reply-To: <4950DD60.4080202@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Jason Rumney wrote:
> 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?



[-- Attachment #2: bug716.diff --]
[-- Type: text/plain, Size: 1546 bytes --]

Index: buffer.c
===================================================================
RCS file: /sources/emacs/emacs/src/buffer.c,v
retrieving revision 1.575
diff -r1.575 buffer.c
2184a2185,2189
> #ifdef REL_ALLOC
> extern void r_alloc_prepare_to_swap_pointers P_ ((POINTER_TYPE **,
> 						  POINTER_TYPE **));
> #endif
> 
2222a2228,2232
> #ifdef REL_ALLOC
>   r_alloc_prepare_to_swap_pointers (&current_buffer->own_text.beg,
> 				    &other_buffer->own_text.beg);
> #endif
> 
Index: ralloc.c
===================================================================
RCS file: /sources/emacs/emacs/src/ralloc.c,v
retrieving revision 1.69
diff -r1.69 ralloc.c
1225a1226,1248
> /* Swap relocatable data between two pointers.
>    This is used by buffer_swap_text.  Since buffer_swap_text swaps the
>    whole text structure in one go, this function has been written to only
>    update the internal pointers back to the variables, ready for when the
>    swap is actually done.  It must be called before the pointers are
>    swapped so that the state is consistent when find_bloc is called.  */
> void
> r_alloc_prepare_to_swap_pointers (p1, p2)
>      POINTER *p1, *p2;
> {
>   bloc_ptr bloc1, bloc2;
>   bloc1 = find_bloc (p1);
>   bloc2 = find_bloc (p2);
>   if (bloc1 == NIL_BLOC || bloc2 == NIL_BLOC)
>     abort ();
> 
>   /* Swap internal pointers back to the variables.  */
>   bloc1->variable = p2;
>   bloc2->variable = p1;
> 
>   /* It would be cleaner to do the actual swap here too, but it would
>      complicate buffer_swap_text.  */
> }

  reply	other threads:[~2008-12-23 14:51 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 [this message]
2008-12-23 15:14       ` Jason Rumney
2008-12-23 17:23         ` Stefan Monnier
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

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

  git send-email \
    --in-reply-to=4950FAF6.808@f2s.com \
    --to=jasonr@f2s.com \
    --cc=716@emacsbugs.donarmstrong.com \
    --cc=mange@freemail.hr \
    --cc=monnier@IRO.UMontreal.CA \
    /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.