OK, we can cancel the alert on the "glutDestroyWindow" crashing the code.  I was calling "glutPostRedisplay" with no current window.

I'm still not sure what to do about the "glutDeinitialize" call.  With some fear and trembling I put a segfault into the "one" demo and crashed it with my screen resolution changed.  The operating system was able to change the resolution back to what it had been, but one of my other windows that had been open was moved to somewhere else on the screen.

Barring screams of pain and outrage, I'm inclined to put out Release Candidate 3 this weekend.

    - John

On 12/13/2011 9:45 PM, John F. Fay wrote:

    I've put in John T's fix of the memory leak (thank you, John).

    In trying to chase down the "close" function, I found where I can crash "freeglut" by mixing timers with window closures.  I added code to the Lorenz demo program to have "freeglut" continue execution when a window is closed, duplicated the window creation code to make a total of four windows, and added support for a "q" key in the keyboard callback that would get the current window and call "glutDestroyWindow" with that window handle as the argument.  When I ran the code, I got a crash on a call to "glutPostRedisplay" from the timer callback.

    Since nobody has complained about this happening (at least, not that I know of), I propose to get the release out the door and then work on fixing the bug in the next release.

    Please check the SVN head again and if there aren't any other issues, I'll try putting out a third release candidate tomorrow night.

        - John F.

On 12/13/2011 6:22 PM, John Tsiombikas wrote:
On Tue, Dec 13, 2011 at 08:13:53PM +0100, cx-Tech@web.de wrote:
dear all,

first of all, I have to report a bug: if I define a function

void close(void)

this function will be executed when closing the window, EVEN if I did
NOT gave freeglut the callback glutCloseFunc(&close)! the function
is just in the same .c file as the main function. renaming it with
"closeme" solved the problem (see the following code).
This has nothing to do with freeglut. You are overriding a standard
POSIX function.

man close

==2570== 265 (4 direct, 261 indirect) bytes in 1 blocks are definitely lost in loss record 87 of 114
==2570== at 0x4025BD3: malloc (vg_replace_malloc.c:236)
==2570== by 0x40772A2: fgHintPresent (freeglut_init.c:217)
==2570== by 0x4077959: glutInit (freeglut_init.c:291)
==2570== by 0x804880E: main (main.c:15)
This is indeed a small leak every time fgHintPresent gets called.

The code at this point is really wrong. Someone was really confused
about the last argument of fghGetWindowProperty.

Attached patch hintpresent.patch to fix it.

==2570== 4,028 (2,072 direct, 1,956 indirect) bytes in 1 blocks are definitely lost in loss record 110 of 114
==2570== at 0x4025BD3: malloc (vg_replace_malloc.c:236)
==2570== by 0x42A19CD: ??? (in /usr/lib/mesa/libGL.so.1.2)
==2570== by 0x42A1E01: ??? (in /usr/lib/mesa/libGL.so.1.2)
==2570== by 0x427D285: ??? (in /usr/lib/mesa/libGL.so.1.2)
==2570== by 0x427A26E: glXGetFBConfigs (in /usr/lib/mesa/libGL.so.1.2)
==2570== by 0x427C402: glXChooseFBConfig (in /usr/lib/mesa/libGL.so.1.2)
==2570== by 0x407F7F3: fgChooseFBConfig (freeglut_window.c:205)
==2570== by 0x407F9FF: fgOpenWindow (freeglut_window.c:768)
==2570== by 0x407DC3C: fgCreateWindow (freeglut_structure.c:106)
==2570== by 0x407F1A4: glutCreateWindow (freeglut_window.c:1183)
==2570== by 0x804881A: main (main.c:16)
This might be a leak in freeglut or it might be a leak in glx. In any
case it's an one-off leak during init, it shouldn't matter much. I'll
look into it some other time.

------------------------------------------------------------------------------ Cloud Computing - Latest Buzzword or a Glimpse of the Future? This paper surveys cloud computing today: What are the benefits? Why are businesses embracing it? What are its payoffs and pitfalls? http://www.accelacomm.com/jaw/sdnl/114/51425149/
_______________________________________________ Freeglut-developer mailing list Freeglut-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freeglut-developer