Skip to content

Commit

Permalink
audio engine: fix order of uninit of context and engine
Browse files Browse the repository at this point in the history
Details here: https://2dimensions.slack.com/archives/C073BQNPQ5T/p1729040397547009?thread_ts=1728503923.737199&cid=C073BQNPQ5T

We shouldn't be uninitializing a context while an engine is actively using it.

Some of the miniaudio docs on this:
![CleanShot 2024-10-16 at 20 16 15@2x](https://github.com/user-attachments/assets/8c87f839-a966-415c-849f-e2882b8f1b05)

![CleanShot 2024-10-16 at 20 18 06@2x](https://github.com/user-attachments/assets/cb168415-0657-449e-ac29-2127e4bf94db)

Diffs=
054e3c5b73 audio engine: fix order of uninit of context and engine (#8350)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
  • Loading branch information
luigi-rosso and luigi-rosso committed Oct 17, 2024
1 parent abd59ac commit cad7c1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a1484308fa29ae83273056dbe5e37a467e06b373
054e3c5b7370c78d59fa4c74d6bf7ff4f25f8f7b
6 changes: 3 additions & 3 deletions src/audio/audio_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@ AudioEngine::~AudioEngine()
}
m_completedSounds.clear();

ma_engine_uninit(m_engine);
delete m_engine;

#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_MACCATALYST || TARGET_OS_IPHONE) && \
!defined(MA_NO_DEVICE_IO)
// m_context is only set when Core Audio is available
Expand All @@ -449,9 +452,6 @@ AudioEngine::~AudioEngine()
}
#endif

ma_engine_uninit(m_engine);
delete m_engine;

#ifdef WITH_RIVE_AUDIO_TOOLS
if (m_levelMonitor != nullptr)
{
Expand Down

0 comments on commit cad7c1b

Please sign in to comment.