[Bug]Timer Crashes the server.

Started by habi, Jul 27, 2023, 01:25 PM

Previous topic - Next topic

habi

Description
Passing player instances which are local variables (which immediately destructs after function returns) to timer crashes the server.

Reproducible
Always
local player=FindPlayer(0);NewTimer("print", 5000, 1, player);After 5 seconds server window withdraws.

What you were doing when the bug happened
Trying to make a function which will display message to particular player after 5 seconds.

I think it is possible to pass player instances safely to timers/functions (rather than by id and later using FindPlayer) because player.Name will be "" immediately after player is disconnected. I have tested it and also the source code of squirrel plugin, CPlayer::GetName confirms this.

What you think caused the bug
In CTimer.cpp sq_addref (and consequently sq_release) was not used while pushing parameter when the type of parameter is OT_INSTANCE, OT_TABLE etc.

Offtopic: Squirrel 3.2 released one year ago. Can we expect new squirrel plugin?

2b2ttianxiu

i tried fix some C-lang error, but failed