473,385 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Debug Assertion Failed! ARGH! NOT AGIAN!! lol

Hey guys, good old
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::DestroyObject()
{
// FIX ME!! MEMORY LEAK!!
if( MeshMaterials != NULL )
delete[] MeshMaterials; //throws here

if( MeshTextures )
{
for( DWORD i = 0; i < NumMaterials; i++ )
{
if( MeshTextures[i] )
MeshTextures[i]->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!!
Jul 22 '05 #1
2 3891
"SorceCode" <so*******@hotmail.com> wrote...
Hey guys, good old
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::DestroyObject()
{
// FIX ME!! MEMORY LEAK!!
if( MeshMaterials != NULL )
delete[] MeshMaterials; //throws here

if( MeshTextures )
{
for( DWORD i = 0; i < NumMaterials; i++ )
{
if( MeshTextures[i] )
MeshTextures[i]->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.


Let me ask: aren't OLE objects supposed to delete themselves when
the last handle is released? If so, why are you 'delete'ing them?
You just 'Release' them and be done, no?

Anyway, if you don't know the answer to this question, we don't
either because OLE and stuff like that is off-topic here. Try
comp.os.ms-windows.programmer.win32 or any newsgroup with .ole.
in it.
Thanks in advance guys!!

Jul 22 '05 #2
<snip>
void w_DXObject::DestroyObject()
{
// FIX ME!! MEMORY LEAK!!
if( MeshMaterials != NULL )
delete[] MeshMaterials; //throws here
MeshMaterials = 0; // missing here

if( MeshTextures )
{
for( DWORD i = 0; i < NumMaterials; i++ )
{
if( MeshTextures[i] )
MeshTextures[i]->Release();
}
delete[] MeshTextures; // and here
MeshTextures = 0; // and here
}
if( Mesh != NULL )
{
Mesh->Release();
}
}


</snip>
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some...
2
by: w3r3w0lf | last post by:
hello! can anyone explain this to me? I get a "debug assertion failed" msg after some time in my prog...: file fclose.c, stream!=null thanks!
1
by: Kapt. Boogschutter | last post by:
Does anyone know Why I'm getting this Error??? Debug Assertion Failed! File: daocore.cpp Line: 42 My code: CDaoDatabase dao; dao.Create("filename");
2
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application...
4
by: A_StClaire_ | last post by:
I read a section of my text on smart "counting" pointers and found it confusing so I decided to get hands-on. however I'm getting "Debug Assertion Failed... Expression:...
2
by: marat | last post by:
I have a managed c++ function below that makes a call to an unmanaged c++ dll .. This function is called from a C# app, resulting in a "Debug Assertion Failed dbgdel.cpp Line 52 Expression:...
4
by: ellieong | last post by:
When i try to run my program, i get this error "debug assertion failed!" and it's caused by this file called "afxtempl.h" at line 262. isn't this header file provided by c++? so how can i get rid...
0
by: lawrence | last post by:
Hi, I made a MFC ActiveX with a CwinThread Class in VC ++. Then i used it on Visual basic. When i try to make an exe i got this error : Debug Assertion Failed! Program: C:\PROGRAM...
4
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.