Browse Source

[Editor] Move thread name assignment in audio preview

This method is not an instance method so cannot be used this way, it
instead sets the name of the *calling* thread. Putting it in the thread
function makes it work correctly.
A Thousand Ships 9 months ago
parent
commit
64fed07809
1 changed files with 2 additions and 1 deletions
  1. 2 1
      editor/audio_stream_preview.cpp

+ 2 - 1
editor/audio_stream_preview.cpp

@@ -109,6 +109,8 @@ void AudioStreamPreviewGenerator::_update_emit(ObjectID p_id) {
 }
 
 void AudioStreamPreviewGenerator::_preview_thread(void *p_preview) {
+	Thread::set_name("AudioStreamPreviewGenerator");
+
 	Preview *preview = static_cast<Preview *>(p_preview);
 
 	float muxbuff_chunk_s = 0.25;
@@ -208,7 +210,6 @@ Ref<AudioStreamPreview> AudioStreamPreviewGenerator::generate_preview(const Ref<
 
 	if (preview->playback.is_valid()) {
 		preview->thread = memnew(Thread);
-		preview->thread->set_name("AudioStreamPreviewGenerator");
 		preview->thread->start(_preview_thread, preview);
 	}