Advertisement

luabind and a strange exception

Started by July 22, 2004 02:50 PM
3 comments, last by Krun 20 years, 3 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
What assertion is failing?
Advertisement
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