Crashes on device->drop()
Crashes on device->drop()
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?
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
-
randomMesh
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
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.
- 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
-
Radikalizm
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
-
Radikalizm
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
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 budgethendu 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.
