pure virtual call runtime exception

fiesch

13-10-2005 22:00:15

Hi.

On desctruction of a paging scene i get a pure virtuall call error in


on->traversal (UnregisterCameraTraversal(c));

in OgrePagingLandScapeOctreeSceneManager.cpp, Line 617

on has a valid pointer in __vfptr,
mIsRegisterdToCam is false,
nodeDataPerCam size=0;
mDebugRectangle2d =0;

in the scene setup, the node being tried to detach is "CamYawNode",
a sceneNode i use for cam yaw. (Camera is directly linked to this)

any ideas?

fiesch

13-10-2005 22:09:25

hm additional info: the cam was not directly on that node but one below that and the node one above the "CamYawNode" is still there, too - but the root node is already gone

[edit]
made sure: this only happens with the pagingmanager

fiesch

13-10-2005 23:15:44

More information:
i "produced" another crash explicitly destroying the nodes and cameras.

in

void PagingLandScapeOctreeSceneManager::destroyAllCameras(void)

OgrePagingLandScapeOctreeSceneManager.cpp L437

the Camera passed to destroyCamera looks just plain wrong (and pretty sure is)
the pointer has the value 0xfeeefeee (strange value but perhaps an "invalid" marker)

tuan kuranes

14-10-2005 08:06:46

using cvs ?

could you post the whole node + camera code creation
and the way you obtain crash so that I reproduce the bug ?

fiesch

14-10-2005 09:54:47

Hi.
Problem occurs on current cvs version, debugging with MSVC7.1

creationCode sceneManager:

scnManager = root->getSceneManager( ST_EXTERIOR_REAL_FAR );
scnManager->setWorldGeometry( Ogre::String("paginglandscape2.cfg") );


creation code camera:

cam = scnManager->createCamera("PlayCam");
// Position it at 500 in Z direction
cam->setPosition(Vector3(0,0,500));
// Look back along -Z
cam->lookAt(Vector3(0,0,-300));
cam->setNearClipDistance(5);

camYawNode = scnManager->getRootSceneNode()->createChildSceneNode("CamYawNode");
camPitchNode = camYawNode->createChildSceneNode("CamPitchNode");
camPitchNode->attachObject(cam);


general creation code:

scnManager->setAmbientLight( ColourValue( 0.1, 0.1, 0.1 ) );
scnManager->setShadowTechnique( SHADOWTYPE_TEXTURE_MODULATIVE );

//scnManager->setWorldGeometry( "terrain.cfg" );
scnManager->setSkyDome( true, "Examples/CloudySky", 30, 6);

controlledEntity = scnManager->createEntity( "Robot", "robot.mesh" );
controlledEntity->setCastShadows( true );
playerNode = scnManager->getRootSceneNode()->createChildSceneNode( "RobotNode", Vector3( 50, 0, 0 ) );
playerNode->attachObject( controlledEntity );
playerNode->yaw(Degree(45));
controlledNode = playerNode;

Light* light = scnManager->createLight( "Light1" );
light->setType( Light::LT_POINT );
light->setPosition( Vector3(0, 150, 250) );

light->setDiffuseColour( 1.0, 1.0, 1.0 );
light->setSpecularColour( 1.0, 1.0, 1.0 );

Light* light3 = scnManager->createLight( "Light3" );
light3->setType( Light::LT_DIRECTIONAL );
light3->setDiffuseColour( ColourValue( .25, .25, 0 ) );
light3->setSpecularColour( ColourValue( .25, .25, 0 ) );
light3->setDirection( Vector3( 0, -1, 1 ) );


finishing creation up with:

scnManager->getRootSceneNode()->removeChild(camYawNode);
//link cam to the player model
playerNode->addChild(camYawNode);


crash occurs on:

scnManager->destroyAllCameras();


at the given location...
can't reproduce it right now since a change in the code to add ogreODE to the cvs version seems to crash on me

tuan kuranes

14-10-2005 10:38:50

thanks, reproduced the bug and did fix it in CVS.

Was about famous law "virtual call in destructor/constructor are no virtual" that I did fail.

so ~octreenode is no more virtual and do the same job ~node did.

fiesch

14-10-2005 11:00:21

thanks, when do you think the cvs-change will be public?

tuan kuranes

14-10-2005 11:06:03

it usually take a day.

fiesch

14-10-2005 11:50:43

hm could you possibly post your changes here? i have to get a dev version out to a freelancer tomorrow..

tuan kuranes

14-10-2005 13:04:58

--

fiesch

14-10-2005 13:39:25

got it, thank you!

tuan kuranes

14-10-2005 13:53:38

you surely need some case search and replace.
Pagelist => PageList
scape => Scape

fiesch

15-10-2005 09:51:14

Hm in the cvs you still have some case issues...

and unfortunately it still crashes on me on the same location

this is the call trace


Plugin_PagingLandScapeSceneManager2.dll!Ogre::PagingLandScapeOctreeCamera::getId() Zeile 90 + 0x11 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::OcclusionElement::removeCamNodeData(Ogre::PagingLandScapeOctreeCamera * cam=0xfeeefeee) Zeile 53 + 0x8 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::UnregisterCameraTraversal::onTree(Ogre::PagingLandScapeOctree & n={...}) Zeile 30 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::PagingLandScapeOctree::traversal(const Ogre::TraversalConst & tr={...}) Zeile 156 + 0x10 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::PagingLandScapeOctreeSceneManager::destroyCamera(Ogre::Camera * cam=0xfeeefeee) Zeile 401 + 0x26 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::PagingLandScapeSceneManager::destroyCamera(Ogre::Camera * cam=0xfeeefeee) Zeile 1343 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::PagingLandScapeOctreeSceneManager::destroyAllCameras() Zeile 437 + 0x19 C++
Plugin_PagingLandScapeSceneManager2.dll!Ogre::PagingLandScapeSceneManager::destroyAllCameras() Zeile 1353 C++
> client_a2.exe!PlayState::exit() Zeile 41 + 0x15 C++
client_a2.exe!GameManager::~GameManager() Zeile 23 + 0x26 C++
client_a2.exe!GameManager::`scalar deleting destructor'() + 0x2b C++
client_a2.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00141f14, HINSTANCE__ * __formal=0x00000000) Zeile 35 + 0x82 C++
client_a2.exe!WinMainCRTStartup() Zeile 251 + 0x30 C
kernel32.dll!7c816d4f()
ntdll.dll!7c925b4f()
kernel32.dll!7c8399f3()


PlayState::exit calls the sceneManager->destroyAllCameras() in Line 41....

tuan kuranes

15-10-2005 10:32:09

ok fixed in cvs. upper scenemanager class was invalidating iterator.

fiesch

15-10-2005 10:53:09

thanks again for the quick fix, hope the public cvs updates quickly

tuan kuranes

15-10-2005 10:56:33

you should use ogre-cvsmailing list.

you get a mail per commit, including the patch, nearly as soon as commit is done.

(you can parse archives too.)

fiesch

15-10-2005 11:16:27

ah good tip ;) noticed there was also a corresponding newsgroup, gonna use that is easier on my inbox filters

tonyhnz

20-10-2005 04:59:06

I have had the same problem with the SDK version.

Can you advise what files were changed so I can apply the fixes back to the SDK code I have.

tuan kuranes

20-10-2005 05:36:35

Best way to do that is to use ogre-cvs mail archive.
The patch is within the commit mail.