Author Topic: Debug Assertion Failed!  (Read 2381 times)

Anara

  • Guest
Debug Assertion Failed!
« on: 4 October 2009, 01:25:48 »
I got a Debug Assertion Failed upon running my compiled source!
file : dbgheap.c
line: 1511

expression: _CrtIsValidHeapPointer(puserdata)

the problem seems to be

Config &Config::getInstance(){
   static Config config;
   return config;
}

I am using VC++9

anyidea how I can fix it? The internet seems clueless!

-Archmage-

  • Moderator
  • Dragon
  • ********
  • Posts: 5,887
  • Make it so.
    • View Profile
    • My Website
Re: Debug Assertion Failed!
« Reply #1 on: 4 October 2009, 01:28:55 »
This is in the wrong boards, it should be in bugs, not mods.

Welcome to the forums, and I hope there is a solution to this problem.
Egypt Remastered!

Proof: Owner of glest@mail.com

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Debug Assertion Failed!
« Reply #2 on: 4 October 2009, 10:50:23 »
the problem seems to be

Config &Config::getInstance(){
   static Config config;
   return config;
}

The problem will be in your project settings most likely.
To ensure the config is built on the heap, you could do this,
Code: [Select]
Config &Config::getInstance(){
static Config *config = NULL;
if ( !config ) {
config = new Config();
}
return *config;
}

But you'd be better off trying to sort out the problem with your project settings.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Anara

  • Guest
Re: Debug Assertion Failed!
« Reply #3 on: 5 October 2009, 11:15:22 »
I don't suppose you know what the project setting I need to change is do you?

thanks

 

anything