I'm using ogre with pthread for the thread management and there seem to be any problem.
The main application creates a thread which I use to handle everything that has to do with Ogre (initialization, loading resources, scene creation, rendering and disposal). Everything works ok, but when I call 'delete Root' to destroy Ogre (also inside the same thread) a segmentation fault rises.
I've tried the code using no threads (but the main one) and this problem does not appear. Also, I've tested the threads without adding any Ogre code and they work fine. In fact, everything works fine if I don't call 'delete Root'.
Any ideas?
Thanks in advance
Problems deleting Ogre::Root when using threads
-
- Kobold
- Posts: 38
- Joined: Thu Jun 14, 2007 9:27 am
- x 2
-
- Kobold
- Posts: 38
- Joined: Thu Jun 14, 2007 9:27 am
- x 2
First of all, thank you very much for replying so fast, Varela, it's wonderfull finding a community where people takes so much interest in helping each other.
But, unluckily, shutting down Ogre does not release all the resources, neither closes the Graphic system.
I've looking to the Ogre::~Root and shutting down the system is the first thing it does, but it also deletes a lot of other member pointers. I was thinking of deleting them myself, but they are declared as private, and I don't want to change Ogre code in order to have my program working with new releases of Ogre.
Any more ideas??
PD->I've also looked at the API and I haven't found anything
But, unluckily, shutting down Ogre does not release all the resources, neither closes the Graphic system.
I've looking to the Ogre::~Root and shutting down the system is the first thing it does, but it also deletes a lot of other member pointers. I was thinking of deleting them myself, but they are declared as private, and I don't want to change Ogre code in order to have my program working with new releases of Ogre.
Any more ideas??
PD->I've also looked at the API and I haven't found anything
- Numsgil
- Gremlin
- Posts: 197
- Joined: Sun Jan 29, 2006 10:20 pm
I *think* you need to initialize and destroy Ogre in the app's primary thread.
Darwinbots, leading amateur artificial life simulator.
- bibiteinfo
- Gremlin
- Posts: 197
- Joined: Wed Apr 12, 2006 2:48 pm
- Location: Montreal, Canada
-
- Kobold
- Posts: 38
- Joined: Thu Jun 14, 2007 9:27 am
- x 2
-
- Kobold
- Posts: 38
- Joined: Thu Jun 14, 2007 9:27 am
- x 2
I think this does not work either... Whenever I try to delegte mRoot from the main thread I get a segmentation fault message (and the program crashes!)
I think the only solution is using Ogre in the main thread but for design issues I am not willing to do so. The only solution I´ve reached is to call mRoot->shutDown(), but this does not unload the resources.
Anyway, the program shows no problems when rebooting.
I think the only solution is using Ogre in the main thread but for design issues I am not willing to do so. The only solution I´ve reached is to call mRoot->shutDown(), but this does not unload the resources.
Anyway, the program shows no problems when rebooting.
- bibiteinfo
- Gremlin
- Posts: 197
- Joined: Wed Apr 12, 2006 2:48 pm
- Location: Montreal, Canada
From this thread :
http://www.ogre3d.org/phpBB2/viewtopic. ... stroy+main
and the documentation
http://www.ogre3d.org/docs/api/html/cla ... ystem.html
http://www.ogre3d.org/phpBB2/viewtopic. ... stroy+main
and the documentation
http://www.ogre3d.org/docs/api/html/cla ... ystem.html
Well it talks for startup sequence, but ending sequence is probably the same.Call this from your main thread before starting your other threads (which themselves should call registerThread()). Note that if you start your own threads, there is a specific startup sequence which must be respected and requires synchronisation between the threads:
- Bontakun
- Goblin
- Posts: 290
- Joined: Tue Dec 09, 2003 6:09 am
- Location: Melbourne, Australia
No actually those two references talk about when you have multiple threads calling the rendering system. I have multiple threads in my app but only one thread which is not the primary thread which calls Ogre and the rendering system.bibiteinfo wrote:From this thread :
http://www.ogre3d.org/phpBB2/viewtopic. ... stroy+main
and the documentation
http://www.ogre3d.org/docs/api/html/cla ... ystem.html
- Bonta (eveonline:Dentad)