You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
screen/screen-4.0.3-resize.patch

117 lines
3.0 KiB

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