Closed Krzmbrzl closed 3 years ago
Thanks 😘 I hereby confirm the fix is working!
good catch
Unfortunately, it is not yet completely cleaned. When starting ArmA with "-showScriptErrors" and using removePerframeHandler there is still this error:
Error in expression <,"","_handle"];clib_perframe_pfhhandles set[_handle,_foreachindex];}foreach clib>
Error position: <set[_handle,_foreachindex];}foreach clib>
Error Type Any, expected Number
File tc\CLib\addons\CLib\perframe\fn_removePerframeHandler.sqf..., line 1
Pull latest version from master i already fixed that script error
The variable was initialized as
deletedIndexes
in PerFrame/fn_init.sqf but was referenced asdeletedIndices
in PerFrame/fn_removePerFrameHandler.sqf.Thus the variable that was referenced in the remove function was nil, causing that part of the code to abort at the first time that variable is referenced. This prevents old PFHs to actually get removed, causing these old handlers to accumulate.
This is where that variable currently gets used (this is the only usage I was able to find using GitHub's search): https://github.com/TaktiCool/CLib/blob/ee1f6a02cb3b0bd31265e8ae68c8658d9af808e0/addons/CLib/PerFrame/fn_removePerframeHandler.sqf#L32-L48
Credit to @formtapez for discovering the accumulation of PFHs using the following code:
(to be executed multiple times from the in-game debug console) This demonstrates that in CBA the PFH gets removed as expected whereas in CLib this is not the case.