Crash when closing game window

Hi,

First off I’m using DirectX version and running 3.6.

When I call the Exit() command my game closes fine, no problems what so ever.
However if I close it using the “x” on the game window when running in windowed mode the game crashes at the following lines

  _secondryVertexDataIndex.Clear();
                    _secondryVertexDataIndex.AddRange(tmpindex);
                    _secondVertexBuffer = new VertexBuffer(Engine.graphicsDevice, VertexPositionColourNormalTexture.VertexDeclaration, vertextcounter,
                        BufferUsage.WriteOnly);
                    _secondVertexBuffer.SetData(verts.ToArray());
                    _secondVertexCount = vertextcounter / 3;

its the _secondVertexBuffer = new VertexBuffer line that it crashes at. It has a NullReferenceException.

My first though was that the graphicDevice was Null or vertextcounter had an invalid value but this is not the case.
Any help would be appreciated.

You’re running 3.6? If the issue is what I think it is, this was fixed before the 3.6 release. Also, is this desktop DirectX? Because you put this topic in the windows phone category.

1 Like

Ok don’t know how I put it under windows phone. Thought I’d selected windows. Anyhow fixed that now.

I have installed latest 3.6 monogames. Normal I use source, but not sure on this project will check and make sure it is refrencing 3.6 and let you know.

1 Like

Just Checked and it says that I’m using version 3.6.0.1625

Can you try the develop version or build from source to find out the exact location of the error?

Ok. Won’t be today but ill do it.

1 Like