068b0a3
commit 45d0c395945d2ae0f99748d030a8bffcb4cb46f9
068b0a3
Author: Sadrul Habib Chowdhury <sadrul@users.sourceforge.net>
068b0a3
Date:   Wed Sep 23 16:22:06 2009 -0400
068b0a3
068b0a3
    Fix a crash when resizing.
068b0a3
    
068b0a3
    The alternate screen has to be reset after a resize. Thanks to
068b0a3
    Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> for pointing
068b0a3
    this out. Closes savannah bug #26742.
068b0a3
068b0a3
diff --git a/src/resize.c b/src/resize.c
068b0a3
index 0bf5f3d..5477bb7 100644
068b0a3
--- a/src/resize.c
068b0a3
+++ b/src/resize.c
068b0a3
@@ -497,6 +497,7 @@ CheckMaxSize(wi)
068b0a3
 int wi;
068b0a3
 {
068b0a3
   unsigned char *oldnull = null;
068b0a3
+  unsigned char *oldblank = blank;
068b0a3
   struct win *p;
068b0a3
   int i;
068b0a3
   struct mline *ml;
068b0a3
@@ -542,49 +543,34 @@ int wi;
068b0a3
 # endif
068b0a3
 #endif
068b0a3
 
068b0a3
+#define RESET_AFC(x, bl) do { if (x == old##bl) x = bl; } while (0)
068b0a3
+
068b0a3
+#define RESET_LINES(lines, count) \
068b0a3
+  do { \
068b0a3
+    ml = lines; \
068b0a3
+    for (i = 0; i < count; i++, ml++) \
068b0a3
+      { \
068b0a3
+	RESET_AFC(ml->image, blank); \
068b0a3
+	RESET_AFC(ml->attr, null); \
068b0a3
+	IFFONT(RESET_AFC(ml->font, null)); \
068b0a3
+	IFCOLOR(RESET_AFC(ml->color, null)); \
068b0a3
+	IFCOLORX(RESET_AFC(ml->colorx, null)); \
068b0a3
+      } \
068b0a3
+  } while (0)
068b0a3
+
068b0a3
   /* We have to run through all windows to substitute
068b0a3
-   * the null references.
068b0a3
+   * the null and blank references.
068b0a3
    */
068b0a3
   for (p = windows; p; p = p->w_next)
068b0a3
     {
068b0a3
-      ml = p->w_mlines;
068b0a3
-      for (i = 0; i < p->w_height; i++, ml++)
068b0a3
-	{
068b0a3
-	  if (ml->attr == oldnull)
068b0a3
-	    ml->attr = null;
068b0a3
-#ifdef FONT
068b0a3
-	  if (ml->font == oldnull)
068b0a3
-	    ml->font = null;
068b0a3
-#endif
068b0a3
-#ifdef COLOR
068b0a3
-	  if (ml->color == oldnull)
068b0a3
-	    ml->color= null;
068b0a3
-#ifdef COLORS256
068b0a3
-	  if (ml->colorx == oldnull)
068b0a3
-	    ml->colorx = null;
068b0a3
-#endif
068b0a3
-#endif
068b0a3
-	}
068b0a3
+      RESET_LINES(p->w_mlines, p->w_height);
068b0a3
+
068b0a3
 #ifdef COPY_PASTE
068b0a3
-      ml = p->w_hlines;
068b0a3
-      for (i = 0; i < p->w_histheight; i++, ml++)
068b0a3
-	{
068b0a3
-	  if (ml->attr == oldnull)
068b0a3
-	    ml->attr = null;
068b0a3
-# ifdef FONT
068b0a3
-	  if (ml->font == oldnull)
068b0a3
-	    ml->font = null;
068b0a3
-# endif
068b0a3
-# ifdef COLOR
068b0a3
-	  if (ml->color == oldnull)
068b0a3
-	    ml->color= null;
068b0a3
-#  ifdef COLORS256
068b0a3
-	  if (ml->colorx == oldnull)
068b0a3
-	    ml->colorx = null;
068b0a3
-#  endif
068b0a3
-# endif
068b0a3
-	}
068b0a3
+      RESET_LINES(p->w_hlines, p->w_histheight);
068b0a3
+      RESET_LINES(p->w_alt_hlines, p->w_alt_histheight);
068b0a3
 #endif
068b0a3
+
068b0a3
+      RESET_LINES(p->w_alt_mlines, p->w_alt_height);
068b0a3
     }
068b0a3
 }
068b0a3
 
068b0a3
commit 7cb17d54cc8fca88e17d6d1e7be2fd49daef1b9d
068b0a3
Author: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
068b0a3
Date:   Wed Sep 23 16:24:21 2009 -0400
068b0a3
068b0a3
    Typo fix.
068b0a3
    
068b0a3
    Fixing this typo fixes this crash:
068b0a3
    https://bugzilla.redhat.com/show_bug.cgi?id=515055
068b0a3
068b0a3
diff --git a/src/resize.c b/src/resize.c
068b0a3
index 5477bb7..9c7b70f 100644
068b0a3
--- a/src/resize.c
068b0a3
+++ b/src/resize.c
068b0a3
@@ -517,7 +517,7 @@ int wi;
068b0a3
 #ifdef COLOR
068b0a3
   mline_old.color = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth);
068b0a3
 # ifdef COLORS256
068b0a3
-  mline_old.colorx = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth);
068b0a3
+  mline_old.colorx = (unsigned char *)xrealloc((char *)mline_old.colorx, maxwidth);
068b0a3
 # endif
068b0a3
 #endif
068b0a3
   if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx)))