Henri Verbeet : wined3d: Don't delete queries from the wrong context.
Alexandre Julliard
julliard at winehq.org
Wed Jan 7 10:57:12 CST 2009
Module: wine
Branch: master
Commit: 46eabd5b16f5c868fae3c41b0585561e0dc38ec1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=46eabd5b16f5c868fae3c41b0585561e0dc38ec1
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Jan 7 09:00:55 2009 +0100
wined3d: Don't delete queries from the wrong context.
---
dlls/wined3d/query.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index 6925572..05e114c 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -63,8 +63,18 @@ static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
ref = InterlockedDecrement(&This->ref);
if (ref == 0) {
ENTER_GL();
+ /* Queries are specific to the GL context that created them. Not
+ * deleting the query will obviously leak it, but that's still better
+ * than potentially deleting a different query with the same id in this
+ * context, and (still) leaking the actual query. */
if(This->type == WINED3DQUERYTYPE_EVENT) {
- if(GL_SUPPORT(APPLE_FENCE)) {
+ if (((WineQueryEventData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
+ || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
+ {
+ FIXME("Query was created in a different context, skipping deletion\n");
+ }
+ else if(GL_SUPPORT(APPLE_FENCE))
+ {
GL_EXTCALL(glDeleteFencesAPPLE(1, &((WineQueryEventData *)(This->extendedData))->fenceId));
checkGLcall("glDeleteFencesAPPLE");
} else if(GL_SUPPORT(NV_FENCE)) {
@@ -72,8 +82,16 @@ static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
checkGLcall("glDeleteFencesNV");
}
} else if(This->type == WINED3DQUERYTYPE_OCCLUSION && GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
- GL_EXTCALL(glDeleteQueriesARB(1, &((WineQueryOcclusionData *)(This->extendedData))->queryId));
- checkGLcall("glDeleteQueriesARB");
+ if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
+ || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
+ {
+ FIXME("Query was created in a different context, skipping deletion\n");
+ }
+ else
+ {
+ GL_EXTCALL(glDeleteQueriesARB(1, &((WineQueryOcclusionData *)(This->extendedData))->queryId));
+ checkGLcall("glDeleteQueriesARB");
+ }
}
LEAVE_GL();
More information about the wine-cvs
mailing list