Crashes on device->drop()

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
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Crashes on device->drop()

Post by kiel814 »

Some of the tutorials (and the projects that I'm doing based on them) crash when I close the Irrlicht window.

Trying to debug the issue, I reached IReferenceCounted.h line 124.

It cannot execute:
delete this;

Because "this" is a bad pointer, so I get an "Access violation reading location 0xblablabla" error.

This happens, for example, in tutorial 03.CustomSceneNode
Can someone help?
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

Did you modify anything in the tutorial? It sounds like the engine is still referencing something that was already deleted
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Post by kiel814 »

I don't think so...
I've definitely opened all of the tutorials, but I don't think I've modified them.

I'm downloading them again to be sure... But I don't think that's the problem.
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Post by kiel814 »

Nope, definitely that's not it...
I just re-downloaded and replaced all the tutorials.

However, I have isolated the problem:
- The issue only occurs with OpenGL.
- The issue does not occur if, instead of closing the irrlicht window, I close the console window (driver selection window).

Ideas?
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

kiel814 wrote:Ideas?
A lot, but better show some code, so the ideas would make sense.
"Whoops..."
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Post by kiel814 »

Here's the code for tutorial 1, the only differences are:
- I changed the driver to OpenGL.
- I removed all the comments to post it here in the forum.

Just run it and then close the Irrlicht window.

Code: Select all

#include <irrlicht.h>

using namespace irr;

using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif

int main()
{
	IrrlichtDevice *device =
		createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
			false, false, false, 0);

	if (!device)
		return 1;

	device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
		rect<s32>(10,10,260,22), true);

	IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
	if (!mesh)
	{
		device->drop();
		return 1;
	}
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

	if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setMD2Animation(scene::EMAT_STAND);
		node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	}

	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

	while(device->run())
	{
		driver->beginScene(true, true, SColor(255,100,101,140));

		smgr->drawAll();
		guienv->drawAll();

		driver->endScene();
	}

	device->drop();

	return 0;
}
nathanf534
Posts: 199
Joined: Tue Dec 09, 2008 2:55 am

Post by nathanf534 »

The code runs fine for me, make sure you are using the correct dll version, and make sure you haven't edited any of the irrlicht headers.
while(signatureEmpty){cout<<wittyComment();}
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Post by kiel814 »

I just run the code on another PC and it works fine.
Maybe there is an issue with my video card.

I'm lost here. If someone has any clues, you are most welcome.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Update your gfx card driver, make sure the card does not crash with other 3d apps (test some high performance benchmark tests such as fur mark)
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Post by kiel814 »

I've got a SiS Mirage 3 video driver.
I just updated it.
The chip is SiS672.

I still get the same error...
It is pretty weird that this only happens in OpenGL
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

To be honest, that card is pretty horrible for 3D graphics, from what I know it has very limited OGL support
kiel814
Posts: 37
Joined: Mon May 23, 2011 4:30 pm

Post by kiel814 »

Apparently so :(
That soft you recommended, FurMark, does not even run.
It says it requires an OpenGL 2.0 or higher.
And my gfx card uses 1.5.
Damn, I guess I'll just have to use my desktop computer, instead of my laptop.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Post by hendu »

You can still use Irrlicht's software devices, or if you want better OGL support, I think Mesa's llvmpipe runs on windows. It supports 2.1 with full GLSL 1.2, and is pretty damn fast for a software driver.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

hendu wrote:You can still use Irrlicht's software devices, or if you want better OGL support, I think Mesa's llvmpipe runs on windows. It supports 2.1 with full GLSL 1.2, and is pretty damn fast for a software driver.
While that is definitely true, I really wouldn't recommend either of them for actual development of games due to possible unforeseen bugs and or issues, and because of a very limited performance budget
Post Reply