Module: wine
Branch: master
Commit: c6d4df8b1c39c50dfe929a7c485758298a4fc730
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c6d4df8b1c39c50dfe929a7c4…
Author: Huw Davies <huw(a)codeweavers.com>
Date: Tue Dec 15 21:04:42 2009 +0000
ole32: Fix several memory leaks in the tests.
Found by Valgrind.
---
dlls/ole32/tests/stg_prop.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/tests/stg_prop.c b/dlls/ole32/tests/stg_prop.c
index 8260946..37e8e10 100644
--- a/dlls/ole32/tests/stg_prop.c
+++ b/dlls/ole32/tests/stg_prop.c
@@ -178,6 +178,7 @@ static void testProps(void)
ok(var.vt == VT_LPSTR && !lstrcmpA(U(var).pszVal, val),
"Didn't get expected type or value for property (got type %d, value %s)\n",
var.vt, U(var).pszVal);
+ PropVariantClear(&var);
/* read clipboard format */
spec.ulKind = PRSPEC_PROPID;
@@ -282,6 +283,7 @@ static void testProps(void)
ok(var.vt == VT_LPSTR && !lstrcmpA(U(var).pszVal, val),
"Didn't get expected type or value for property (got type %d, value %s)\n",
var.vt, U(var).pszVal);
+ PropVariantClear(&var);
IPropertyStorage_Release(propertyStorage);
IPropertySetStorage_Release(propSetStorage);
@@ -364,11 +366,13 @@ static void testCodepage(void)
ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
ok(var.vt == VT_LPSTR && !strcmp(U(var).pszVal, "hi"),
"Didn't get expected type or value for property\n");
+ PropVariantClear(&var);
/* This seemingly non-sensical test is to show that the string is indeed
* interpreted according to the current system code page, not according to
* the property set's code page. (If the latter were true, the whole
* string would be maintained. As it is, only the first character is.)
*/
+ var.vt = VT_LPSTR;
U(var).pszVal = (LPSTR)wval;
hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
@@ -376,6 +380,8 @@ static void testCodepage(void)
ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
ok(var.vt == VT_LPSTR && !strcmp(U(var).pszVal, "h"),
"Didn't get expected type or value for property\n");
+ PropVariantClear(&var);
+
/* now that a property's been set, you can't change the code page */
spec.ulKind = PRSPEC_PROPID;
U(spec).propid = PID_CODEPAGE;
Module: wine
Branch: master
Commit: cd623036fc1b01517e789fe675675a9f94428dcd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cd623036fc1b01517e789fe67…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Tue Dec 15 17:51:37 2009 +0100
wined3d: Mark the draw buffer as dirty in context_create().
Currently callers of this function are responsible for setting the draw buffer
correctly, but they don't do a very good job:
- swapchain_init() sets the draw buffer to GL_BACK if there's a back buffer,
even though the context's target is always the front buffer.
- swapchain_create_context_for_thread() depends on (eventually) being called
by FindContext().
- create_primary_opengl_context() and
IWineD3DSwapChainImpl_SetDestWindowOverride() don't bother setting a draw
buffer at all.
Just marking the draw buffer dirty lets the context management sort it all
out, and is much simpler.
---
dlls/wined3d/context.c | 1 +
dlls/wined3d/swapchain.c | 22 +---------------------
2 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 2f27997..30590af 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1349,6 +1349,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
ret->surface = (IWineD3DSurface *) target;
ret->current_rt = (IWineD3DSurface *)target;
ret->render_offscreen = surface_is_offscreen((IWineD3DSurface *) target);
+ ret->draw_buffer_dirty = TRUE;
ret->tid = GetCurrentThreadId();
if(This->shader_backend->shader_dirtifyable_constants((IWineD3DDevice *) This)) {
/* Create the dirty constants array and initialize them to dirty */
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index fb902ea..7e6c71e 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -809,6 +809,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
hr = WINED3DERR_NOTAVAILABLE;
goto err;
}
+ context_release(swapchain->context[0]);
}
else
{
@@ -841,30 +842,9 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
IWineD3DSurface_SetContainer(swapchain->backBuffer[i], (IWineD3DBase *)swapchain);
((IWineD3DSurfaceImpl *)swapchain->backBuffer[i])->Flags |= SFLAG_SWAPCHAIN;
-
- if (surface_type == SURFACE_OPENGL)
- {
- ENTER_GL();
- glDrawBuffer(GL_BACK);
- checkGLcall("glDrawBuffer(GL_BACK)");
- LEAVE_GL();
- }
- }
- }
- else
- {
- /* Single buffering - draw to front buffer */
- if (surface_type == SURFACE_OPENGL)
- {
- ENTER_GL();
- glDrawBuffer(GL_FRONT);
- checkGLcall("glDrawBuffer(GL_FRONT)");
- LEAVE_GL();
}
}
- if (swapchain->context[0]) context_release(swapchain->context[0]);
-
/* Swapchains share the depth/stencil buffer, so only create a single depthstencil surface. */
if (present_parameters->EnableAutoDepthStencil && surface_type == SURFACE_OPENGL)
{