Skip to content

Script error with CBA_fnc_addPerFrameHandler when used in scheduled. #230

@commy2

Description

@commy2

While debuging PFHs under extreme conditions I found a problem with the function when used together with the scheduler.

0 spawn {while {true} do {systemChat str ([{[_this select 1] call CBA_fnc_removePerFramehandler}, 0, []] call cba_fnc_addPerFrameHandler)}}

Causes these to pop up randomly:

20:00:08 Error in expression <, nil];
cba_common_perFrameHandlerArray set [_handle, nil];
_newArray = [];

cba>
20:00:08   Error position: <set [_handle, nil];
_newArray = [];

cba>
20:00:08   Error Zero divisor
20:00:08 File x\cba\addons\common\fnc_removePerFrameHandler.sqf, line 15

The reason seems to be the scheduler stoping between these lines:

    _publicHandle = GVAR(PFHhandles) pushback _handle;
    _data = [_func, _delay, 0, diag_tickTime, _params, _publicHandle];
    GVAR(perFrameHandlerArray) pushBack _data;

Causing the OEF event to iterate through GVAR(PFHhandles) before GVAR(perFrameHandlerArray) is set.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions