Getting crazy

RicE

04-02-2007 14:16:34

Hello,

I'm starting to study Ogre and OgreNewt (I've already developed Newton based applications however), and although the first experiments with demos started fine, I'm now in some X-files mode.

I've created an application based on the simple vehicle demo, the only ambition at this time being to use a real vehicle mesh. The mesh itself is fine, since it works well in other apps, and was running well during my frst attempts with Ogre. During some time it has worked nice, but now there must have been some tiny change somewhere that broke the thing and I can't figure which.

The symptom is an access violation reading memory, located in following function of ogrememorymanager.h (instruction pointer is shown on the closing brace of the function when stopped on the error) :


inline void *operator new(size_t reportedSize)
{
if( !gProcessID )
gProcessID = Ogre::MemoryManager::instance()._getProcessID();
return Ogre::MemoryManager::instance().op_new_sc( reportedSize, gProcessID );
}


This function is called from the second new in the following sequence of the createScene :

OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, floornode, false );
OgreNewt::Body* bod = new OgreNewt::Body( m_World, col );


When following the code step by step, it occurs when the new function is called and gProcessId is not null. Hewever, it seems that this function should not be called, since the reportedSize argument is someting crazy (looks like a pointer in fact).

If I insert statements like :

char *buffer = new char[10] ;
char *buffer1 = new char[10] ;


before the first new, the buffer and buffer1 variables are properly created, but this time, the program breaks on the new TreeCollision invocation.

I've carrefully checked all options of the project, comparing them to the ones of original demos and I can't see any difference. I'va also carrefully checked that the proper debug versions of DLLs are used.

I've also reinstalled Ogre and OgreNewt, without any result.

So now I'm stuck, and would greatly appreciate any suggestion on where to search.

Many thanks in advance.

walaber

04-02-2007 19:07:23

you have created a World object, right?

RicE

04-02-2007 22:38:41

Thanks a lot Wallaber for pointing me on my stupidity :-(

I just took the wrong source (ExampleApplication) as starting base instead of OgreNewtonApplication).

And I didn't notice it since m_World was not 0 (I was pretty sure that C++ objects were initialized with 0s), so that it appeared as properly initialized.

Sorry for such a stupid problem and thanks again for your support.