WineD3D: fix a null pointer dereference

Stefan Dösinger stefan at codeweavers.com
Tue Aug 21 10:30:27 CDT 2007


Am Dienstag, 21. August 2007 16:55 schrieb Roderick Colenbrander:
> Hi,
>
> This patch gets Tiberian Sun working in ddraw OpenGL mode. Before it
> suffered
>
> >from a null pointer dereference bug.
This patch is ok with me, but there's a bad flaw with opengl'ed ddraw I want 
to point out

Ddraw apps can just create offscreen surfaces and perform blits between them 
without creating a render target. To do anything in opengl, a context is 
needed, and a context needs a drawable. So no gl context without a render 
target in gl.

Now the current code checks if the locked surface is a render target, and 
crashes because the render target array doesn't exist. This patch simply 
fixes this NULL pointer dereference.

The essential problem remains though, that ddraw operations in gl won't work 
unless the app creates a render target. Currently it works because only 
operations on render targets use opengl, but there is code to have opengl do 
offscreen<->offscreen blits. That code(stretch_rect_fbo) is only used for 
d3d9, but when activated for ddraw apps too, we have to be careful.



More information about the wine-devel mailing list