removeImageLayer causes a crash

classic Classic list List threaded Threaded
3 messages Options
adrianj adrianj
Reply | Threaded
Open this post in threaded view
|

removeImageLayer causes a crash

Hello,

I am trying to use removeImageLayer() but my application keep on crashing in Debug mode. I read on a previous post that osg is not thread safe and I should not be calling this function from a different thread. Can anyone give me an example of how I post a message to my thread so I can perform my action? Do I use osg::Operation? or is there a newer better way?

Many thanks for your help!!

Adrian
Andreas Roth Andreas Roth
Reply | Threaded
Open this post in threaded view
|

Re: removeImageLayer causes a crash

Either use an osg::Operation or call removeImageLayer during the update or event traversal.
adrianj adrianj
Reply | Threaded
Open this post in threaded view
|

Re: removeImageLayer causes a crash

Hello,

Thank you for the reply. I did a bit more research. When I was removing the layer I did not see the memory being freed as I would expect, so I was doing a delete on the layer that I had created. Obviously this was causing a problem later on. I later found out that the version of osgEarth that I was using had some problems with freeing up the layer memory so I upgraded to version 2.9.0. Now it is all working very nicely.

Thank you!