🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

luabind and a strange exception

Started by
3 comments, last by Krun 19 years, 10 months ago
I have this code: luaVM = lua_open(); luabind::open( luaVM ); module( luaVM ) [ class_<Console>("Console") .def("write", &Console::write) ]; luabind::get_globals( luaVM )["con"] = &Console::getInstance(); (...) try { luaError = lua_dostring( luaVM, line.c_str() ); } catch (...) { } And now if line is for example: con:write( "aha" ) It works just fine. But if con:write gets incorrect data: con:write( 666 ) there are popping up some strange assert´s and show is finished by this message: Unhandled exception at 0x77f65a58 in dog.exe: User breakpoint. Anyone knows how to handle this exception?
--KriS
Advertisement
What assertion is failing?
Hi,

file: dbgdel.cpp
line: 52
expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

I'm using LUA 5.02, luabind beta 6 and VC++ 7.1.
--KriS
Where is this file located? Is it a luabind, lua or msvc file? How did you fix this problem? I thought it would be a LuaBind problem. Strange.
Quote: Original post by KriS-XK
Hi,

file: dbgdel.cpp
line: 52
expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

I'm using LUA 5.02, luabind beta 6 and VC++ 7.1.


This assert happens when you try to deallocate a peace of the heap that you didn't allocate in the first place. A simple example would be:

void* somePtr = (void*)12356;
delete somePtr;

[Edited]

This might be because the function Console::write expects a pointer to a char array (const char*) and when you pass it a numbe it thinks that the number represents a memory adress to a string array so after it is done using it it trys to delete it causing the assert.

This topic is closed to new replies.

Advertisement