STR #909

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.1 ]

STR #909

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:4 - High, e.g. key functionality not working
Scope:2 - Specific to an operating system
Subsystem:Example Programs
Summary:font.exe test crashes in Fl_Browser
Version:1.1-current
Created By:oksid
Assigned To:matt
Fix Version:1.1-current (SVN: v4411)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text top right image
 
#1 oksid
08:21 Jun 12, 2005
Windows XP Home SP2 / Visual C++.Net 2003 (not tested on other OS)
fltk-1.1.x-r4181
fontd.exe in debug mode
749 fonts installed on the system
----------------------------------------------------------
call stack:
-----------
> fontsd.exe!Fl_Browser::insert(int line=-17891601, FL_BLINE * t=0x009d2c80)  Ligne 142 + 0x9 C++
         fontsd.exe!Fl_Browser::insert(int line=-17891601, const char * newtext=0x0012fe60, void * d=0x00000000)  Ligne 172 C++
         fontsd.exe!Fl_Browser::add(const char * newtext=0x0012fe60, void * d=0x00000000)  Ligne 446 C++
         fontsd.exe!main(int argc=1, char * * argv=0x00385cc8)  Ligne 158 C++
         fontsd.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, char * lpCmdLine=0x00141f10, int nCmdShow=1)  Ligne 86 + 0x17 C
         fontsd.exe!WinMainCRTStartup()  Ligne 390 + 0x39 C
         kernel32.dll!7c816d4f()
         ntdll.dll!7c925b4f()
         kernel32.dll!7c8399f3()
------------------------------------------------------
Code :
void Fl_Browser::insert(int line, FL_BLINE* t) {
  if (!first) {
    t->prev = t->next = 0;
    first = last = t;
  } else if (line <= 1) {
    inserting(first, t);
    t->prev = 0;
    t->next = first;  // first == 0xfeeefeee
    t->next->prev = t; // <--- crash here !!!
    first = t;
  } else if (line > lines) {
-----------------------------------------------------
 
 
#2 oksid
07:49 Jun 16, 2005
I found the bug. I have ~740 fonts but Fl::set_fonts returns ~1300.
Which over the statically allocated array.

Here is the fix :
=================================================
--- fonts.cxx.old Thu Feb 24 22:55:12 2005
+++ fonts.cxx Thu Jun 16 16:41:52 2005
@@ -52,8 +52,8 @@
 
 Fl_Hold_Browser *fontobj, *sizeobj;
 
-int *sizes[1000];
-int numsizes[1000];
+int **sizes;
+int *numsizes;
 int pickedsize = 14;
 
 void font_cb(Fl_Widget *, long) {
@@ -139,6 +139,8 @@
   int i = fl_choice("Which fonts:","-*","iso8859","All");
 #endif
   int k = Fl::set_fonts(i ? (i>1 ? "*" : 0) : "-*");
+  sizes = new int*[k];
+  numsizes = new int[k];
   for (i = 0; i < k; i++) {
     int t; const char *name = Fl::get_font_name((Fl_Font)i,&t);
     char buffer[128];
 
 
#3 matt
13:47 Jul 11, 2005
Fixed in Subversion repository.

Thank you for the patch!
 
bottom left image   bottom right image

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.