I'm sorry, but I still can't reproduce the problem.
I wrote the following test based on what you provided:
class TestLN
{
public:
void *TestLineNumber()
{
asIScriptContext *ctx = asGetActiveContext();
const char *script_section;
int line = ctx->GetLineNumber(0, 0, &script_section);
return 0;
}
};
bool Test()
{
bool fail = false;
// Test crash in GetLineNumber
// http://www.gamedev.net/topic/638656-crash-in-ctx-getlinenumber/
{
asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->RegisterInterface("foo");
engine->RegisterObjectType("Test", 0, asOBJ_REF | asOBJ_NOCOUNT);
engine->RegisterObjectMethod("Test", "foo @TestLineNumber()", asMETHOD(TestLN, TestLineNumber), asCALL_THISCALL);
TestLN t;
engine->RegisterGlobalProperty("Test test", &t);
asIScriptModule *mod = engine->GetModule("test", asGM_ALWAYS_CREATE);
mod->AddScriptSection("a","foo @f = test.TestLineNumber();");
mod->AddScriptSection("b"," // nothing to compile");
int r = mod->Build();
if( r < 0 )
TEST_FAILED;
engine->Release();
}
return fail;
}
What do I need to change to reproduce the crash?
Edited by Andreas Jonsson, 28 February 2013 - 08:19 PM.