View Issue Details

IDProjectCategoryView StatusLast Update
0004713The Dark ModScript/Defpublic21.03.2020 17:45
Reporterstgatilov Assigned Tostgatilov  
PrioritylowSeverityminorReproducibilityN/A
Status assignedResolutionopen 
Product VersionTDM 2.06 
Target VersionTDM 2.09 
Summary0004713: Starting new script thread with method is wrong
DescriptionIn order to start a thread in script, you write:
  thread myFunc(param1, param2, param3);
Here myFunc must be a global function.

Using a method of an object as myFunc is wrong, because it won't receive "this" pointer. Moreover, if you run such a script in debug build, it will crash on assert.
However, such scripts are present "in the wild".
Primary example is "Accountant 2": it crashes on startup in debug build due to error in line convbelt.script:13.

We should find a way to fix this issue. For example:
1. Make sure that this error crashes release build too, then fix missions.
2. Find some limited case when calling method without this is legal, and make sure it is properly supported in all builds.
Steps To Reproduce1. Start debug build of TDM.
2. Start mission "Accountant 2".

You'll get assertion failed in Script_Interpreter.cpp on OP_OBJTHREAD case in this line:
  assert( st->c->value.argSize == func->parmTotal );
Additional InformationNote: there is function called callFunctionOn in tdm_util.script, which allows you to create new thread like this:
  thread callFunctionOn("frob_ignite", child);
Here new thread calls child.frob_ignite();

This function does not support passing parameters.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
25.12.2017 10:06 stgatilov New Issue
25.12.2017 10:09 stgatilov Additional Information Updated View Revisions
01.07.2018 04:05 stgatilov Assigned To => stgatilov
01.07.2018 04:05 stgatilov Status new => assigned
21.03.2020 17:45 stgatilov Target Version => TDM 2.09