emacs-devel
[Top][All Lists]
Advanced

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

Re: 'struct window' cleanup #5 [Re: 'struct window' cleanup #4]


From: Eli Zaretskii
Subject: Re: 'struct window' cleanup #5 [Re: 'struct window' cleanup #4]
Date: Tue, 03 Jul 2012 18:58:40 +0300

> Date: Tue, 03 Jul 2012 09:54:56 +0400
> From: Dmitry Antipov <address@hidden>
> CC: address@hidden
> 
> > Shouldn't we test w->window_end_valid for being non-zero, before we
> > trust the value of w->window_end_vpos?  Zero for a vertical position
> > is perfectly valid, so if i is zero, you can err here.
> 
> The core idea is to have window_end_vpos (and window_end_pos) equal to -1
> for just created window (i.e. pointer returned by make_window).  For such
> a window, window_end_valid is always 0, and passing such a window to
> main redisplay routines is an error (so there are 4 debugging checks
> commented with "Just initialized windows should not pass here"). If the
> window is completely initialized, window_end_vpos may be 0 and
> window_end_valid may be 0 or 1.

AFAICT, window_end_valid and window_end_vpos have nothing to do with
initializing windows.  They are flags used by the display engine in
order to know when certain redisplay optimizations are possible.  So I
don't see how a completely initialized window has anything to do with
the fact that window_end_vpos is valid.  Am I missing something?

But if what you write is true, the commentary to window_end_vpos and
window_end_pos should be modified, because right now the comments tell
explicitly not to trust the values of these two if window_end_valid is
zero.  If not every use of those two must test window_end_valid first,
then we should explain in the comments when such a test is needed.

> > Bother: doesn't the comparison with w->buffer test for a specific
> > buffer, rather than just non-nil value?  The corresponding assignment,
> > viz.:
> >
> >>     if (accurate_p)
> >>       {
> >> -      w->window_end_valid = w->buffer;
> >> +      w->window_end_valid = 1;
> >>         w->update_mode_line = 0;
> >>       }
> >
> > seems to handle the case when the display is "accurate".  Perhaps use
> > a different value, like 2, for this situation?
> 
> I tried a lot, but never hits the situation where window buffer was changed
> on the way from mark_window_display_accurate_1 to note_mouse_highlight (buffer
> text may be changed, of course). So I suppose that w->window_end_valid = 
> w->buffer
> is just a synonym for w->window_end_valid = Qt.

I'm not convinced, sorry.  note_mouse_highlight is usually invoked
asynchronously (when the mouse hovers above some mouse-sensitive part
of the display), so deliberately producing a situation could be
tricky.  The fact that you didn't hit that combination doesn't
necessarily prove it is impossible.  So I would still suggest to use a
special value, because bugs in these areas are notoriously hard to
track down.

Thanks.



reply via email to

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