unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Effect of deletions on indirect buffers (Bug#8219)
@ 2011-03-11 19:48 Chong Yidong
  2011-03-11 20:07 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Chong Yidong @ 2011-03-11 19:48 UTC (permalink / raw)
  To: emacs-devel; +Cc: 8219

Indirect bufffers are allowed to have their own values of point,
BUF_BEGV, and BUF_ZV (indeed, that's one of their roles).  Their other
attributes inherit from the base buffer, e.g.

#define BUF_Z(buf) ((buf)->text->z)

where `text' points to the base buffer's text object.

Now consider what happens when a deletion is performed in buffer A,
which is the base buffer for an indirect buffer B.  It appears that the
responsible functions, such as del_range_2, only update the attributes
of buffer A, making no effort to update buffer B.

Hence, in the aftermath of a deletion, buffer B's values of PT (and
BUF_BEGV and BUF_ZV) can be larger than BUF_ZV.  This is the proximate
cause of the crash in Bug#8219: there, we have

 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
     && find_composition (prev_pt, -1, &start, &end, &prop, buffer)

and find_composition aborts because prev_pt is larger than the size of
the buffer.


I'm not sure what the best solution is.  The narrowest fix is to change
find_composition, and the functions it calls, so that it does not abort
when supplied with a position that's beyond BUF_Z.  This might be the
best approach for the emacs-23 branch.

However, I suspect that we have other places in the code that assumes
that if a point is smaller than BUF_ZV, it's necessarily smaller than
BUF_Z---which we now see if not that case.  So, a more comprehensive fix
is needed for the trunk.

Any thoughts?



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-03-14 16:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-11 19:48 Effect of deletions on indirect buffers (Bug#8219) Chong Yidong
2011-03-11 20:07 ` Eli Zaretskii
2011-03-11 20:58   ` bug#8219: " Chong Yidong
2011-03-12  8:15     ` Eli Zaretskii
2011-03-11 23:19   ` Stefan Monnier
2011-03-12  9:01     ` Eli Zaretskii
2011-03-12 20:47       ` Stefan Monnier
2011-03-13 16:30         ` bug#8219: " Chong Yidong
2011-03-13 17:09           ` Chong Yidong
2011-03-13 22:29         ` Chong Yidong
2011-03-14  2:41           ` bug#8219: " Juanma Barranquero
2011-03-14 16:18             ` Chong Yidong

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