Skip to content

Commit 81193b8

Browse files
tomaaronstechyo
authored andcommitted
Use Godot thread for reflection handling
1 parent 1c12153 commit 81193b8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ GlobalSteamAudioState *SteamAudioServer::get_global_state(bool should_init) {
240240
}
241241

242242
void SteamAudioServer::start_refl_sim() {
243+
refl_thread.instantiate();
243244
refl_thread->start(callable_mp(this, &SteamAudioServer::run_refl_sim));
244245
}
245246

@@ -322,13 +323,12 @@ SteamAudioServer::SteamAudioServer() {
322323
is_refl_thread_processing.store(false);
323324
is_running.store(true);
324325
local_states_have_changed.store(false);
325-
refl_thread = memnew(Thread);
326326
}
327327

328328
SteamAudioServer::~SteamAudioServer() {
329329
is_running.store(false);
330330
refl_thread->wait_to_finish();
331-
memdelete(refl_thread);
331+
refl_thread.unref();
332332

333333
if (!self->is_global_state_init.load()) {
334334
return;

src/server.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SteamAudioServer : public Object {
3737
void init_scene(IPLSceneSettings *scene_cfg);
3838
void start_refl_sim();
3939
void run_refl_sim();
40-
Thread *refl_thread = nullptr;
40+
Ref<Thread> refl_thread;
4141

4242
protected:
4343
static void _bind_methods();

0 commit comments

Comments
 (0)