Skip to content

fix(citizen-scripting-core): fixed ClearTimeout after Wait#3260

Open
yanislgha wants to merge 1 commit intocitizenfx:masterfrom
yanislgha:fix/clear-timeout
Open

fix(citizen-scripting-core): fixed ClearTimeout after Wait#3260
yanislgha wants to merge 1 commit intocitizenfx:masterfrom
yanislgha:fix/clear-timeout

Conversation

@yanislgha
Copy link

Goal of this PR

A ClearTimeout() in another thread or after a wait() has no effect, and the SetTimeout continues to execute.

How is this PR achieving the goal

I basically wrote a function to remove a bookmark directly in the ScriptHost.cpp to manage bookmarks between threads, etc.

This PR applies to the following area(s)

FiveM, RedM, Server, ScRT: Lua

Successfully tested on

Game builds: v3258

Platforms: Windows, Linux

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

fixes #3259

@github-actions github-actions bot added RedM Issues/PRs related to RedM ScRT: Lua Issues/PRs related to the Lua scripting runtime invalid Requires changes before it's considered valid and can be (re)triaged labels Mar 18, 2025
@github-actions github-actions bot added triage Needs a preliminary assessment to determine the urgency and required action and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Mar 19, 2025
{
for (auto it = list->begin(); it != list->end();)
{
if (it->bookmark == bookmark)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to tell the runtime to cleanup the bookmark. In lua the bookmark represents the thread data's index in the lua registry. If it is not unregistered, it will never be cleaned up.

@outsider31000
Copy link
Contributor

@yanislgha can you have a look at what iridium wrote.

@poco8537
Copy link
Contributor

@yanislgha are you still working on this PR, or would you like me to take over?

@yanislgha
Copy link
Author

I'm in vacation rn so I'll take a look on tuesday if nobody do it :)

@outsider31000
Copy link
Contributor

@yanislgha which tuesday ?

@outsider31000
Copy link
Contributor

@poco8537 you should just take over that tuesday is long gone

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

Labels

RedM Issues/PRs related to RedM ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Citizen.ClearTimeout does not work

4 participants