DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L1958
Version: 2.0-current


The Filename input from FileChooser shows a weird green frame. This seems
to be caused
be fltk::drawframe() being called with strings of length 6 in which case
the check for(;*s;) misses
the end of the string.
The following patch fixes the problem here:

diff -r bdcaf122cb77 src/UpBox.cxx
--- a/src/UpBox.cxx     Tue May 06 21:24:51 2008 +0200
+++ b/src/UpBox.cxx     Tue May 06 21:28:48 2008 +0200
@@ -231,19 +231,19 @@ void fltk::drawframe(const char* s, int 
     // draw bottom line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x, y+h-1, x+w-1, y+h-1);
-    if (--h <= 0) break;
+    if (--h <= 0 || !*s) break;
     // draw right line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x+w-1, y+h-1, x+w-1, y);
-    if (--w <= 0) break;
+    if (--w <= 0 || !*s) break;
     // draw top line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x, y, x+w-1, y);
-    y++; if (--h <= 0) break;
+    y++; if (--h <= 0 || !*s) break;
     // draw left line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x, y+h-1, x, y);
-    x++; if (--w <= 0) break;
+    x++; if (--w <= 0 || !*s) break;
   }
 }
 
@@ -258,19 +258,19 @@ void fltk::drawframe2(const char* s, int
     // draw top line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x, y, x+w-1, y);
-    y++; if (--h <= 0) break;
+    y++; if (--h <= 0 || !*s) break;
     // draw left line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x, y+h-1, x, y);
-    x++; if (--w <= 0) break;
+    x++; if (--w <= 0 || !*s) break;
     // draw bottom line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x, y+h-1, x+w-1, y+h-1);
-    if (--h <= 0) break;
+    if (--h <= 0 || !*s) break;
     // draw right line:
     setcolor(*s++ + (GRAY00-'A'));
     drawline(x+w-1, y+h-1, x+w-1, y);
-    if (--w <= 0) break;
+    if (--w <= 0 || !*s) break;
   }
 }


Link: http://www.fltk.org/str.php?L1958
Version: 2.0-current

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to