Lock VB access violation

Started by
12 comments, last by Sfpiano 20 years, 8 months ago
No there''s something there immediately after the CreateVB call, so that''s not it
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
Advertisement
Can you post some more complete code. In particular the complete path between the CreateVertexBuffer() call that should be filling in the pSB_VB pointer and the Lock call that uses that pointer. Because at the point of the crash, the pSB_VB pointer is uninitialised - which firmly indicates either a memory trash, CreateVertexBuffer() failing or CreateVertexBuffer() not actually being called at all!.

Try putting breakpoints on 1) the Lock() call and 2) the CreateVertexBuffer() calls. See which one triggers first (if it''s not the CreateVertexBuffer() one, something is wrong with your program flow control). Try single stepping the code in between the two, keeping a watch on pSB_VB

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Just a word of advice: be sure to check the ''this'' pointer when you create the buffer and when you try to access it. I know from my experience that sometimes the this pointer would get accidentally trashed (not totally, maybe just some random bit) and then whatever pointers are in the class APPEAR to point to uninitiated memory. And I don''t think something overwrote his vertex buffer pointer, as for the value to correspond to 0xCD many times over appears a bit coincidental (and I never knew 0xCDCDCDCD was RESERVED for uninitiated variables! I just knew that my variables sometimes took on that value....cool!)

Chris Pergrossi
My Realm | "Good Morning, Dave"
Chris PergrossiMy Realm | "Good Morning, Dave"
The problem was never in the CreateVB call, something was getting changed down the line. I changed a couple of things around, and it no longer crashes, but now it doesn''t draw anything. I believe it''s due to the way I''m passing my vertices to the Lock call.
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."

This topic is closed to new replies.

Advertisement