Skip to content

Fix timer error for invalid entity#3552

Closed
bjurd wants to merge 1 commit intowiremod:masterfrom
bjurd:master
Closed

Fix timer error for invalid entity#3552
bjurd wants to merge 1 commit intowiremod:masterfrom
bjurd:master

Conversation

@bjurd
Copy link
Contributor

@bjurd bjurd commented Mar 8, 2026

Timer can fire after the entity has been removed

Error variable trace (ignore the stdout color control chars)

�[38;2;156;241;255mTraces of level 1 (Execute)
�[39m�[38;2;156;241;255m- Local 1 (Level) (number) = 1
�[39m�[38;2;156;241;255m- Local 2 (Info) (table) = table: 0x80887ef681ce68b2
�[39m�[38;2;156;241;255m- Local 3 (Indent) (string) = 
�[39m�[38;2;156;241;255m- Local 4 (Function) (function) = function: 0x80887ef6b2cb1ffa
�[39m�[38;2;156;241;255m- Local 5 (FunctionName) (string) = Execute
�[39m�[38;2;156;241;255m- Local 6 (Local) (number) = 6
�[39m�[38;2;156;241;255m	Traces of level 2 ([Unknown Function])
�[39m�[38;2;156;241;255m	- UpValue 1 (ent) (Entity) = Entity [Invalid]
�[39m�[38;2;156;241;255m	- UpValue 2 (callback) (function) = function: 0x80887ef6fcac4bba
�[39m�[38;2;156;241;255m	- UpValue 3 (internalName) (string) = 479_gmod_wire_expression2_luatimer_simpletimer_19
�[39m�[38;2;156;241;255m	- UpValue 4 (luaTimers) (table) = table: 0x80887ef6b1cb69b2
�[39m�[38;2;156;241;255m	- UpValue 5 (entIndex) (number) = 479
�[39m�[38;2;156;241;255m	- UpValue 6 (name) (string) = simpletimer_19
�[39m�[38;2;156;241;255m	- Local 1 ((*temporary)) (nil) = nil
�[39m�[38;2;156;241;255m	- Local 2 ((*temporary)) (number) = 6.4624744847913e-310
�[39m�[38;2;156;241;255m	- Local 3 ((*temporary)) (Entity) = Entity [Invalid]
�[39m�[38;2;156;241;255m	- Local 4 ((*temporary)) (function) = function: 0x80887ef6fcac4bba
�[39m�[38;2;156;241;255m	- Local 5 ((*temporary)) (string) = attempt to call method 'Execute' (a nil value)
�[39m�[38;2;156;241;255m
[ERROR] entities/gmod_wire_expression2/core/timer.lua:107: attempt to call method 'Execute' (a nil value)
  1. unknown - entities/gmod_wire_expression2/core/timer.lua:107

�[39m�[38;2;156;241;255mTimer Failed! [479_gmod_wire_expression2_luatimer_simpletimer_19][@entities/gmod_wire_expression2/core/timer.lua (line 106)]

Timer can fire after the entity has been removed
@Astralcircle
Copy link
Contributor

Astralcircle commented Mar 8, 2026

Unfortunately, this isn't a solution. The problem is deeper and lies in the fact that the destruct hook isn't being called (i should fix it someday)

@wrefgtzweve
Copy link
Member

Unfortunately, this isn't a solution. The problem is deeper and lies in the fact that the destruct hook isn't being called (i should fix it someday)

True but in the meanwhile it shouldn't error, i think

@Astralcircle
Copy link
Contributor

I'll try to fix the root of the issue today, if that doesn't work then i'll just merge this pr

@Astralcircle
Copy link
Contributor

Also, adding a simple IsValid won't remove the buggy timers on error, which is even worse. So, i'd better close the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants