godotengine / godotengine/godot

Suppress Thread Warning

Open
#100,291 3 comments 0 reactions 0 assignees View on GitHub
discussion topic:core
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

I am currently using Godot 4.3.stable
I do not think testing earlier versions would matter as the @warning_ignore() has changed and this is more of an item that appears to have never been there rather than it not working as intended.

### System information

Windows 11 Godot 4.3,stable

### Issue description

There is no way to suppress this particular warning :

```
W 0:00:01:0042 ~Thread: A Thread object is being destroyed without its completion having been realized.
Please call wait_to_finish() on it to ensure correct cleanup.
core/os/thread.cpp:105 @ ~Thread()
```

This alert while useful, isn't ideal if you want the process to run in the background to avoid making the main UI hang. Note the code still works, but there is no way to suppress the warning.

Also the documentation does not list all of the ids that you can suppress, but there is the current list that I have:
```
- assert_always_false
- assert_always_true
- confusable_capture_reassignment
- confusable_identifier
- confusable_local_declaration
- confusable_local_usage
- constant_used_as_function
- deprecated_keyword
- empty_file
- enum_variable_without_default
- function_used_as_property
- get_node_default_without_onready
- incompatible_ternary
- inference_on_variant
- inferred_declaration
- integer_division
- int_as_enum_without_cast
- int_as_enum_without_match
- narrowing_conversion
- native_method_override
- onready_with_export
- property_used_as_function
- redundant_await
- redundant_static_unload
- renamed_in_godot_4_hint
- return_value_discarded
- shadowed_global_identifier
- shadowed_variable
- shadowed_variable_base_class
- standalone_expression
- standalone_ternary
- static_called_on_instance
- unassigned_variable
- unassigned_variable_op_assign
- unreachable_code
- unreachable_pattern
- unsafe_call_argument
- unsafe_cast
- unsafe_method_access
- unsafe_property_access
- unsafe_void_return
```

### Steps to reproduce

Simply start a thread without following it with ```wait_to_finish()```

Example:
```
var my_thread : Thread = Thread.new()
my_thread.start(my_task, Thread.PRIORITY_LOW)
#my_thread.wait_to_finish() # Ensure the thread completes before proceeding
```

### Minimal reproduction project (MRP)

[Bug Report.zip](https://github.com/user-attachments/files/18101416/Bug.Report.zip)

Contributor guide

Open the contributing guide

Research direction

Start at core/os/thread.cpp:105 and inspect how the Thread destructor emits this warning and how warning suppression identifiers are defined. Compare the reported warning with the existing @warning_ignore() identifiers and related documentation. Done means the warning can be suppressed consistently, or the issue is clarified if it is intentionally unsuppressible, with the identifier list updated if applicable.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.