Firstly , well spotted Greg for (I/O error) RFE = request for enhancement.
Now, of course much stuff (memory+static assignments etc) gets done initially
(always left hanging) but this (static/init) stuff doesn't increase in size
and gets killed instantly with _exit() so we are all NOT CONCERNED with this.
Neither is FLTK concerned with the new/delete pairings I make in my program for
that is MY responsibility alone. But the DYNAMIC packaging of FLTK ought to be
clean.
Having been told the LOOP count idea (!!++) valgrind output can be better
interpreted.
I would assert that there is LIKELY NO BUG in lWind->show() as indeed you will
see below.
Please note here I am using Ubuntu so if my results alone spit leak errors
it MAY JUST BE Ubuntu's libraries (NOT FLTK's responsibility).
This is the error I alluded to prior. This program must be run to make sense of
it.
Just run it with NO arguments at first then under valgrind with args
You'll get the idea.
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Display.H>
static int sCbCount;
void cUserClose(Fl_Widget*pW,void* pU)
{
++sCbCount;
}
int main(int pArgc, char** pArgv)
{
int lW = 640; int lH = 480;
unsigned long lLevel = 0;
unsigned long lTestCount = 1;
if ((pArgc != 3) || (sscanf(pArgv[1],"%lu",&lLevel)!= 1) ||
(sscanf(pArgv[2],"%lu",&lTestCount)!= 1)) {
printf( "\n Usage : %s level testcount\n\n"
" levels are cumulative\n level 0 = Window
built no run no delete\n"
" level 1 = DELETE added\n level 2 = RUN
added\n"
" level 3 = Callback added (programmer
controlled delete)\n"
" level 4 = Display added\n level 5 = Text
Buffer added (not connected to display) \n"
" level 6 = Text Buffer connected to display\n
level 7 = text put into Text Buffer\n\n"
" NOTE for level >= 3 ESC must be pressed twice
for each testcount\n\n"
,pArgv[0]); exit(1);
}
while (lTestCount--) {
Fl_Window* lWind = NULL;
Fl_Text_Display* lDisp = NULL;
Fl_Text_Buffer* lText = NULL;
lWind = new Fl_Window(lW,lH,"Window");
if (lLevel >= 3) {
lWind->callback(cUserClose);
}
if (lLevel >= 4) {
lDisp = new Fl_Text_Display(20, 20, lW-40, lH-40);
}
if (lLevel >= 5) {
lText = new Fl_Text_Buffer();
}
if (lLevel >= 6) {
lDisp->buffer(lText);
}
if (lLevel >= 7) {
lText->text("Red Line\nBlu Line\n");
}
lWind->end();
lWind->show();
if (lLevel >= 3) {
sCbCount = 0;
while (Fl::wait())
{
if (sCbCount == 2)
{
break;
}
}
}
else {
if (lLevel == 2)
{
Fl::run();
}
}
if (lLevel >= 6) {
lDisp->buffer(NULL);
}
if (lLevel >= 5) {
delete lText;
}
if (lLevel >= 1) {
delete lWind;
}
}
return(0);
}
ON MY MACHINE level 2 causes an extra 3 bytes 3 blocks lost per testCount.
It doesnt get errors in ERROR SUMMARY until level 6.
It's possible that this isn't even an error.
But run it and give me an opinion.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev