summaryrefslogtreecommitdiff
path: root/editor/audio_stream_preview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/audio_stream_preview.cpp')
-rw-r--r--editor/audio_stream_preview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/audio_stream_preview.cpp b/editor/audio_stream_preview.cpp
index 2e0c3491f7..8be8735f3e 100644
--- a/editor/audio_stream_preview.cpp
+++ b/editor/audio_stream_preview.cpp
@@ -197,7 +197,8 @@ Ref<AudioStreamPreview> AudioStreamPreviewGenerator::generate_preview(const Ref<
preview->preview->length = len_s;
if (preview->playback.is_valid()) {
- preview->thread = Thread::create(_preview_thread, preview);
+ preview->thread = memnew(Thread);
+ preview->thread->start(_preview_thread, preview);
}
return preview->preview;
@@ -218,7 +219,8 @@ void AudioStreamPreviewGenerator::_notification(int p_what) {
for (Map<ObjectID, Preview>::Element *E = previews.front(); E; E = E->next()) {
if (!E->get().generating) {
if (E->get().thread) {
- Thread::wait_to_finish(E->get().thread);
+ E->get().thread->wait_to_finish();
+ memdelete(E->get().thread);
E->get().thread = nullptr;
}
if (!ObjectDB::get_instance(E->key())) { //no longer in use, get rid of preview