S
SorceCode
Hey guys, good old
Rears its ugly head agian!
Ok heres what Im up to..
DirectX 9.0
C++
Nuff said lol
<Snippit>
class w_DXObject
{
public:
LPD3DXMESH Mesh; // Our mesh object in sysmem
D3DMATERIAL9* MeshMaterials; // Materials for our mesh
LPDIRECT3DTEXTURE9* MeshTextures; // Textures for our mesh
DWORD NumMaterials; // Number of mesh materials
// Constructor
w_DXObject()
{
Mesh = NULL;
MeshMaterials = NULL;
MeshTextures = NULL;
NumMaterials = 0L;
}
// DeConstructor
~w_DXObject()
{
}
void DestroyObject();
bool LoadMesh(LPDIRECT3DDEVICE9 Device, char* strFileName );
bool Render(LPDIRECT3DDEVICE9 Device);
};
void w_DXObject:estroyObject()
{
// FIX ME!! MEMORY LEAK!!
if( MeshMaterials != NULL )
delete[] MeshMaterials; //throws here
if( MeshTextures )
{
for( DWORD i = 0; i < NumMaterials; i++ )
{
if( MeshTextures )
MeshTextures->Release();
}
delete[] MeshTextures; // and here
}
if( Mesh != NULL )
{
Mesh->Release();
}
}
As you can see Im using class ref's of the things I am deleting.
The MS File itself and most of the stuff I have read about this online
show that I should only delete locals. No DLL's are involed in this
prog.
Based on DX9 AppWizard.
Feel free to ask anything else.
Thanks in advance guys!!
Debug Assertion Failed!
File: dbgdel.cpp
Line: 47
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Rears its ugly head agian!
Ok heres what Im up to..
DirectX 9.0
C++
Nuff said lol
<Snippit>
class w_DXObject
{
public:
LPD3DXMESH Mesh; // Our mesh object in sysmem
D3DMATERIAL9* MeshMaterials; // Materials for our mesh
LPDIRECT3DTEXTURE9* MeshTextures; // Textures for our mesh
DWORD NumMaterials; // Number of mesh materials
// Constructor
w_DXObject()
{
Mesh = NULL;
MeshMaterials = NULL;
MeshTextures = NULL;
NumMaterials = 0L;
}
// DeConstructor
~w_DXObject()
{
}
void DestroyObject();
bool LoadMesh(LPDIRECT3DDEVICE9 Device, char* strFileName );
bool Render(LPDIRECT3DDEVICE9 Device);
};
void w_DXObject:estroyObject()
{
// FIX ME!! MEMORY LEAK!!
if( MeshMaterials != NULL )
delete[] MeshMaterials; //throws here
if( MeshTextures )
{
for( DWORD i = 0; i < NumMaterials; i++ )
{
if( MeshTextures )
MeshTextures->Release();
}
delete[] MeshTextures; // and here
}
if( Mesh != NULL )
{
Mesh->Release();
}
}
As you can see Im using class ref's of the things I am deleting.
The MS File itself and most of the stuff I have read about this online
show that I should only delete locals. No DLL's are involed in this
prog.
Based on DX9 AppWizard.
Feel free to ask anything else.
Thanks in advance guys!!