Weird dispose issue [SOLVED]


14-10-2010 20:08:53

I must be going crazy but could someone enlighten me as to why

var texture = TextureManager.Singleton.GetByName(m_TextureName);

if (texture != null)

causes an AccessViolationException every time... and this:


does not?

I don't know what the stack trace etc. is because I'm running from a release build of Mogre 1.7.1.


27-10-2010 13:30:39

In case someone else runs into this problem I'll post the solution.

TextureManager.Singleton.GetByName returns a Ptr object. It needs to be destroyed after use otherwise unexpected behaviour and memory leaks can occur.


07-12-2010 12:35:07

If you want to clear definition of why and how you can check here. I am adding this post in case someone needs it.