Skip to content

Commit

Permalink
Fix uninitializing crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1maker committed Nov 12, 2024
1 parent 9d18302 commit 9f3e695
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions SRC/SRAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ extern "C" SRAL_API bool SRAL_Initialize(int engines_exclude) {
}
extern "C" SRAL_API void SRAL_Uninitialize(void) {
if (!g_initialized)return;
g_currentEngine->Uninitialize();
delete g_currentEngine;
for (uint64_t i = 0; i < g_engines.size(); ++i) {
g_engines[i]->Uninitialize();
delete g_engines[i];
}
g_currentEngine = nullptr;
g_engines.clear();
g_excludes = 0;
Expand Down
7 changes: 4 additions & 3 deletions SRC/UIA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ bool UIA::Initialize() {
}

bool UIA::Uninitialize() {
pProvider->Release();
if (pProvider)pProvider->Release();

pCondition->Release();
if (pCondition)pCondition->Release();

pAutomation->Release();
if (pAutomation)pAutomation->Release();

return true;
}

bool UIA::Speak(const char* text, bool interrupt) {
NotificationProcessing flags = NotificationProcessing_ImportantAll;
if (interrupt)
Expand Down

0 comments on commit 9f3e695

Please sign in to comment.