PDA

View Full Version : Serious bug in renderText()



TheDestroyer
03-30-2012, 12:56 PM
Hello guys :-),

the question is, is this really a bug?

I struggled a lot with the simulation I wrote to understand the cause of the segmentation fault that happens when scrolling, and eventually I found that text rendering is getting the program to crash when the size of the text changes dynamically with the simulation. Please check the simple program in the next link (12 kb). I took it from the example grabber from QtSDK 1.2 and added the text stuff.

http://www.filedropper.com/grabber

The problem with the program is that it crashes when zooming out to some level. In my simulation (which is over 5000 lines, so I canít put it here), I need to zoom out and in a few times to get a segmentation fault.

The wheel of the mouse is supposed to change the size of all the objects in the simulation. 2 lines are entered in the simulation to change the text size, which are in the function paintGL(), and these are:

this->renderText(2,2,0,QVariant(scaleRatio).toString(),Q Font("Arial",static_cast<int>(scaleRatio*10),QFont::Normal,false));
this->renderText(2,2,0,QVariant(scaleRatio).toString(),Q Font("Arial",static_cast<int>(0),QFont::Normal,false));

The first line is active in the example, and the second line is commented out. The difference is the size of the font. With the second line working with no problems when zooming in and out (just uncomment it and comment the first one, and run the program), we can prove that a zero sized font is not a problem for the Widget/OpenGL.

Why does the program crash when zooming out with the first line? itís an obvious bugÖ hasnít anyone faced this problem before?

Thank you for any efforts. This thing is really driving me crazy!!!