unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Two flaws in window.c
@ 2012-10-18  3:26 Dmitry Antipov
  2012-10-18  9:15 ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Antipov @ 2012-10-18  3:26 UTC (permalink / raw)
  To: Emacs development discussions; +Cc: martin rudalics

Some bits in window.c lacks type/liveness checks, and there are two flaws:

(internal-temp-output-buffer-show nil) =>
src/window.c:3350: Emacs fatal error: assertion failed: BUFFERP (buf)

(set-window-vscroll <dead window> 10 t) =>
src/window.c:6487: Emacs fatal error: assertion failed: BUFFERP (w->buffer)

Dmitry



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

* Re: Two flaws in window.c
  2012-10-18  3:26 Two flaws in window.c Dmitry Antipov
@ 2012-10-18  9:15 ` martin rudalics
  2012-10-18  9:41   ` Dmitry Antipov
  0 siblings, 1 reply; 4+ messages in thread
From: martin rudalics @ 2012-10-18  9:15 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

> Some bits in window.c lacks type/liveness checks, and there are two flaws:
> 
> (internal-temp-output-buffer-show nil) =>
> src/window.c:3350: Emacs fatal error: assertion failed: BUFFERP (buf)
> 
> (set-window-vscroll <dead window> 10 t) =>
> src/window.c:6487: Emacs fatal error: assertion failed: BUFFERP (w->buffer)

These should be fixed now.  Do you have any more suggestions?

Thanks, martin




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

* Re: Two flaws in window.c
  2012-10-18  9:15 ` martin rudalics
@ 2012-10-18  9:41   ` Dmitry Antipov
  2012-10-19 10:01     ` martin rudalics
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Antipov @ 2012-10-18  9:41 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs development discussions

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

On 10/18/2012 01:15 PM, martin rudalics wrote:

> These should be fixed now.

Thanks.

> Do you have any more suggestions?

The minor style suggestion is to move window-specific checks to
window.h and use WINDOW_xxx_P macros in CHECK_xxx_WINDOW (attached).

Dmitry

[-- Attachment #2: window-macros.patch --]
[-- Type: text/plain, Size: 1723 bytes --]

=== modified file 'src/lisp.h'
--- src/lisp.h	2012-10-16 02:22:25 +0000
+++ src/lisp.h	2012-10-18 09:32:55 +0000
@@ -1742,20 +1742,6 @@
 #define CHECK_WINDOW_CONFIGURATION(x) \
   CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
 
-/* A window of any sort, leaf or interior, is "valid" if one of its
-   buffer, vchild, or hchild members is non-nil.  */
-#define CHECK_VALID_WINDOW(x)				\
-  CHECK_TYPE (WINDOWP (x)				\
-	      && (!NILP (XWINDOW (x)->buffer)		\
-		  || !NILP (XWINDOW (x)->vchild)	\
-		  || !NILP (XWINDOW (x)->hchild)),	\
-	      Qwindow_valid_p, x)
-
-/* A window is "live" if and only if it shows a buffer.  */
-#define CHECK_LIVE_WINDOW(x)						\
-  CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer),		\
-	      Qwindow_live_p, x)
-
 #define CHECK_PROCESS(x) \
   CHECK_TYPE (PROCESSP (x), Qprocessp, x)
 

=== modified file 'src/window.h'
--- src/window.h	2012-09-20 03:10:52 +0000
+++ src/window.h	2012-10-18 09:33:38 +0000
@@ -970,11 +970,19 @@
        || !NILP (XWINDOW (WINDOW)->vchild)		\
        || !NILP (XWINDOW (WINDOW)->hchild)))
 
+/* A window of any sort, leaf or interior, is "valid" if one
+   of its buffer, vchild, or hchild members is non-nil.  */
+#define CHECK_VALID_WINDOW(WINDOW)				\
+  CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW)
 
 /* Value is non-zero if WINDOW is a live window.  */
 #define WINDOW_LIVE_P(WINDOW)					\
   (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer))
 
+/* A window is "live" if and only if it shows a buffer.  */
+#define CHECK_LIVE_WINDOW(WINDOW)				\
+  CHECK_TYPE (WINDOW_LIVE_P (WINDOW), Qwindow_live_p, WINDOW)
+
 /* These used to be in lisp.h.  */
 
 extern Lisp_Object Qwindowp, Qwindow_live_p;


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

* Re: Two flaws in window.c
  2012-10-18  9:41   ` Dmitry Antipov
@ 2012-10-19 10:01     ` martin rudalics
  0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2012-10-19 10:01 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: Emacs development discussions

 > The minor style suggestion is to move window-specific checks to
 > window.h and use WINDOW_xxx_P macros in CHECK_xxx_WINDOW (attached).

Fine.  Please install these after the feature freeze.

Thanks, martin



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

end of thread, other threads:[~2012-10-19 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-18  3:26 Two flaws in window.c Dmitry Antipov
2012-10-18  9:15 ` martin rudalics
2012-10-18  9:41   ` Dmitry Antipov
2012-10-19 10:01     ` martin rudalics

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