Roderick Colenbrander : wined3d: At the start of RemoveContextFromArray numContexts is decreased by 1, the loop which loops through the whole array doesn' t take this into account.

Alexandre Julliard julliard at winehq.org
Mon May 5 07:14:45 CDT 2008


Module: wine
Branch: master
Commit: e3b662bb20ff2118943f0bbdc627b70f16a4f991
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e3b662bb20ff2118943f0bbdc627b70f16a4f991

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Sat May  3 20:15:58 2008 +0000

wined3d: At the start of RemoveContextFromArray numContexts is decreased by 1, the loop which loops through the whole array doesn't take this into account.

Discovered by Peter Oberndorfer.

---

 dlls/wined3d/context.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index e5b82e5..3341555 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -546,7 +546,8 @@ static void RemoveContextFromArray(IWineD3DDeviceImpl *This, WineD3DContext *con
             ERR("Cannot allocate a new context array, PANIC!!!\n");
         }
         t = 0;
-        for(s = 0; s < This->numContexts; s++) {
+        /* Note that we decreased numContexts a few lines up, so use '<=' instead of '<' */
+        for(s = 0; s <= This->numContexts; s++) {
             if(oldArray[s] == context) continue;
             This->contexts[t] = oldArray[s];
             t++;




More information about the wine-cvs mailing list