[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#716: Bug in buffer-swap-text

From: Stefan Monnier
Subject: bug#716: Bug in buffer-swap-text
Date: Tue, 23 Dec 2008 12:23:54 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>>> 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


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;
@@ -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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]