Problems with InternalName


I just recently upgraded my project from 1.8.1 to 1.9.1, and am having issues with the GeomVertexWriter, specifically with giving the writer a name. If I call:

vertex = GeomVertexWriter(pData, “vertex”);

I end up getting the following error when that line is executed:

Unhandled exception at 0x00859931 in test.exe: 0xC0000005: Access violation reading location 0x00000004.

This is the call stack when I see the error:

test.exe!std::_Tree<std::_Tmap_traits<char const *,PointerTo,pointer_hash,pallocator_single<std::pair<char const * const,PointerTo > >,0> >::_Lbound(const char * const & _Keyval) Line 2092 C++
test.exe!std::_Tree<std::_Tmap_traits<char const *,PointerTo,pointer_hash,pallocator_single<std::pair<char const * const,PointerTo > >,0> >::lower_bound(const char * const & _Keyval) Line 1572 C++
test.exe!std::_Tree<std::_Tmap_traits<char const *,PointerTo,pointer_hash,pallocator_single<std::pair<char const * const,PointerTo > >,0> >::find(const char * const & _Keyval) Line 1550 C++
test.exe!InternalName::make<7>(const char[7] & literal) Line 53 C++

I started using the InternalName::make(“vertex”) static function, but this makes no difference. I’m pulling my hair out, because this worked just fine in 1.8.1 and I can’t seem to figure out what I’m doing wrong.

Any help would be very much appreciated.

Could you give me more information? Which compiler are you building with? Are you building in Release mode with NDEBUG removed from the preprocessor definitions? Could you show more surrounding code?

Note that we build with MSVC 2010 in Panda 1.9.

Also, you could try using InternalName::get_vertex().

Thanks for your reply. I apologize, those are some important details that I glossed right over. I am building with Visual Studio 2012, and I’ve tried compiling against the libraries that come straight from the website, and with libraries that I compiled myself, also with Visual Studio 2012. NDEBUG is not defined. This is the same environment that I used with 1.8.1.

Here is the surrounding code:

PT(Texture) tex;
tex = TexturePool::load_texture(pFilename);
GeomVertexData* pData = new GeomVertexData(m_cName, GeomVertexFormat::get_v3c4t2(), Geom::UH_static);
GeomVertexWriter vertex, color, texture;

vertex = GeomVertexWriter(pData, InternalName::make(“vertex”));
color = GeomVertexWriter(pData, InternalName::make(“color”));
texture = GeomVertexWriter(pData, InternalName::make(“texcoord”);

vertex.add_data3f(-fSize/2, -fSize/2, 0);
vertex.add_data3f(fSize/2, -fSize/2, 0);
vertex.add_data3f(-fSize/2, fSize/2, 0);
vertex.add_data3f(fSize/2, fSize/2, 0);

color.add_data4f(1, 1, 1, 1);
color.add_data4f(1, 1, 1, 1);
color.add_data4f(1, 1, 1, 1);
color.add_data4f(1, 1, 1, 1);

texture.add_data2f(0, 1);
texture.add_data2f(0, 0);
texture.add_data2f(1, 1);
texture.add_data2f(1, 0);

PT(GeomTristrips) pPrimitives = new GeomTristrips(GeomEnums::UH_static);
pPrimitives->add_vertices(0, 1, 2, 3);

PT(Geom) pGeom;
pGeom = new Geom(pData);

PT(GeomNode) pNode;
pNode = new GeomNode(m_cName);

PT(Material) mat = new Material(“material”);

m_Actor = m_pWindow->get_render().attach_new_node(pNode);

I just downloaded Visual C++ Express so that I could use the v100 compiler in Visual Studio 2012 instead of v110, and that fixed all of my issues. Thank you very much for pointing me in the right direction.

Yes, I’m afraid Microsoft breaks compiler compatibility for every new version of Visual C++ they bring out. We’re considering upgrading to VS 2015 for the next release since Microsoft has stopped offering VS 2010 and the Windows 7 SDK installation is riddled with issues.