Heap/Texture Error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
so1odo1o
Posts: 32
Joined: Sat Apr 03, 2010 10:29 am

Heap/Texture Error

Post by so1odo1o »

I get the error:
Windows has triggered a breakpoint in Zombie.exe.

This may be due to a corruption of the heap, which indicates a bug in Zombie.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while Zombie.exe has focus.

The output window may have more diagnostic information.
And it points to this:

Code: Select all

		If you want to create a texture, you may want to call an
		imaginable method IDriver::createTexture. You call
		ITexture* texture = driver->createTexture(dimension2d<u32>(128, 128));
		If you no longer need the texture, call texture->drop().
		If you want to load a texture, you may want to call imaginable
		method IDriver::loadTexture. You do this like
		ITexture* texture = driver->loadTexture("example.jpg");
		You will not have to drop the pointer to the loaded texture,
		because the name of the method does not start with 'create'.
		The texture is stored somewhere by the driver.
		\return True, if the object was deleted. */
		bool drop() const
		{
			// someone is doing bad reference counting.
			_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0)

			--ReferenceCounter;
			if (!ReferenceCounter)
			{
				delete this;
				return true;
			}

			return false;
		}
I am not sure what to do about this. The only area in my code where I use texture is when I load into a mesh using driver->getTexture, such as:

Code: Select all

SMaterial material;
	material.Lighting = false;
	material.setTexture(0, driver->getTexture(
		"media/zombie.png"));
	myZombie->getMaterial(0) = material;
Any help is appreciated, thanks.
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

As the comment says - textures are just an example.
You probably call drop() for something which you didn't create with new or with a function starting with create.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
so1odo1o
Posts: 32
Joined: Sat Apr 03, 2010 10:29 am

Post by so1odo1o »

Well I have made sure that I am dropping everything I create, so would it be correct to assume that this is the reason: This may also be due to the user pressing F12 while ZombieWorld.exe has focus.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

Make sure you're not dropping something too early, or dropping something that shouldn't be dropped.

Pardon my confusion, but what would f12 do?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

so1odo1o wrote:Well I have made sure that I am dropping everything I create
what is "everything you created" for you meaning ???
remember that you don't create a texture with "getTexture" !!! ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply