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: 716@emacsbugs.donarmstrong.com
Subject: bug#716: Bug in buffer-swap-text
Date: Wed, 24 Dec 2008 07:15:26 +0800	[thread overview]
Message-ID: <4951710E.2080407@f2s.com> (raw)
In-Reply-To: <jwv4p0u24yy.fsf-monnier+emacsbugreports@gnu.org>

Stefan Monnier wrote:
> 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(&current_buffer->own_text.beg);
>   r_alloc_reset_variable(&other_buffer->own_text.beg);
>
> after the swap.  It could use the untested patch below.  WDYT?
>
>
> === 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;
>   
This removes the consistency check, without which we would have taken 
much longer to find this problem, as Emacs would not have aborted when 
no bloc could be found, and the problem would have been memory 
corruption later when that bloc of memory was moved and the wrong 
pointer updated.






  reply	other threads:[~2008-12-23 23:15 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
2008-12-23 23:15           ` Jason Rumney [this message]
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=4951710E.2080407@f2s.com \
    --to=jasonr@f2s.com \
    --cc=716@emacsbugs.donarmstrong.com \
    --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.