File: 060_pgupdown_crash.patch

package info (click to toggle)
newt 0.52.2-10%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 836 kB
  • ctags: 27
  • sloc: makefile: 186; sh: 5
file content (38 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff -ruN newt-0.52.2-old/checkboxtree.c newt-0.52.2/checkboxtree.c
--- newt-0.52.2-old/checkboxtree.c	2006-01-19 21:37:14.000000000 +0000
+++ newt-0.52.2/checkboxtree.c	2006-01-19 21:37:29.000000000 +0000
@@ -537,6 +537,18 @@
     free(co);
 }
 
+static void ctEnsureLimits( struct CheckboxTree *ct ) {
+    struct items **listEnd = ct->flatList + ct->flatCount - 1;
+    if (ct->firstItem < ct->flatList)
+        ct->firstItem = ct->flatList;
+    if (ct->currItem < ct->flatList)
+        ct->currItem = ct->flatList;
+    if (ct->firstItem > listEnd) {
+        ct->firstItem = listEnd;
+        ct->currItem = listEnd;
+    }
+}
+
 struct eventResult ctEvent(newtComponent co, struct event ev) {
     struct CheckboxTree * ct = co->data;
     struct eventResult er;
@@ -648,6 +660,7 @@
 		ct->currItem -= co->height;
 		ct->firstItem -= co->height;
 	    }
+	    ctEnsureLimits( ct );
 
 	    ctDraw(co);
 	    if(co->callback) co->callback(co, co->callbackData);
@@ -664,6 +677,7 @@
 	    	ct->currItem += co->height;
 		ct->firstItem += co->height;
 	    }
+	    ctEnsureLimits( ct );
 
 	    ctDraw(co);
 	    if(co->callback) co->callback(co, co->callbackData);