PDA

View Full Version : crash in LayeredWindow2 example



_diman
10-27-2012, 07:43 AM
Hi guys,
sorry for my poor English.
I have got a crash with corrupted heap on start LayeredWindow2 example. It's repeated stable.
I have investigated problem and got the following result:
the problem is located in the .\Sources\GL\WGL\opengl_window_provider_wgl.cpp file in the
void CL_OpenGLWindowProvider_WGL::flip(int interval) method
After change bottom code
CL_PixelBuffer pixelbuffer(width, height, cl_r8);
on this
CL_PixelBuffer pixelbuffer(width, height + 1, cl_r8);
the crash is not repeated.
May be OS allocate new page and heap corruoted is not located by OS more, but the method is need more memory (heiht * 2 or height * 3 )

PS sorry for my poor English.
PSS CLanLib v.2.3.6

rombust
10-28-2012, 09:11 AM
I have seen this exact crash before.

Unfortunately I cannot remember the outcome of the investigation into it.

But, I do remember I also fixed the crash by using: CL_PixelBuffer pixelbuffer(width, height + 1, cl_r8);

But (if I remember correctly), updating the graphics card driver fixed the problems.

Maybe this problem should be looked at again.

What is your graphics card?
What is the graphics card driver version number?

_diman
10-28-2012, 12:36 PM
Graphics card: NVidia, Geforce GT 540M
Driver release data: 27.03.11
version: 8.17.12.6792

I'll try to update driver and I will write to thread results by 15.00 GMT

_diman
10-28-2012, 03:27 PM
It looks like I have found the solution of the problem.
I read the manual of the opengl and found that:
http://www.opengl.org/sdk/docs/man/xhtml/glPixelStore.xml
This method stores many options of the glReadPixels.
One of them is GL_UNPACK_ALIGNMENT whose default value is 4.
I remember that the width of the widow in the example is 650px which is not divided on 4.
After that I tried to change the width of the window to 652px and the problem is not repeated.
Could you please check the solution and fix the problem takeing into account current states of params of glPixelStore?
Thank you.

PS I've updated drivers but it not resolve the problem

rombust
10-28-2012, 07:43 PM
Looking at the documentation, you are correct.

Many thanks for finding and solving the problem.

rombust
11-01-2012, 09:42 AM
Applied patch to SVN (For ClanLib 2.3 and ClanLib 3.0 devel)

Note, I used GL_PACK_ALIGNMENT, not GL_UNPACK_ALIGNMENT.

"Six of the twelve storage parameters affect how pixel data is returned to client memory. They are as follows ... GL_PACK_ALIGNMENT" <-- which is what glReadPixels does

(Not tested patch)

_diman
11-03-2012, 03:34 PM
The patch fix issue. Thanks