Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 2568 #2569

Merged
merged 4 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aws-cpp-sdk-core/source/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ namespace Aws
void CleanupEnumOverflowContainer()
{
Aws::Delete(g_enumOverflow);
g_enumOverflow = nullptr;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ namespace Aws
void ShutdownComponentRegistry()
{
std::unique_lock<std::mutex> lock(s_registryMutex);
assert(s_registry);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep these asserts, but it will crash apps build in debug mode.


Aws::Delete(s_registry);
s_registry = nullptr;
Expand Down Expand Up @@ -80,7 +79,11 @@ namespace Aws
void TerminateAllComponents()
{
std::unique_lock<std::mutex> lock(s_registryMutex);
assert(s_registry);

if (!s_registry) {
// Registry already shut down -- nothing to do.
return;
}

for(const auto it : *s_registry)
{
Expand All @@ -93,4 +96,4 @@ namespace Aws

} // namespace ComponentRegistry
} // namespace Utils
} // namespace Aws
} // namespace Aws
15 changes: 15 additions & 0 deletions tests/aws-cpp-sdk-eventbridge-tests/AwsSdkMisuseTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,18 @@ TEST_F(AwsSdkMisuseTest, MissingCurlyBracesTest)
ASSERT_FALSE(outcomeAfterShutdown.IsSuccess());
ASSERT_EQ((Aws::Client::CoreErrors) outcomeAfterShutdown.GetError().GetErrorType(), Aws::Client::CoreErrors::NOT_INITIALIZED);
}

TEST_F(AwsSdkMisuseTest, MultipleShutdownTest)
{
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Trace;

Aws::InitAPI(options);

// Shutdown the API.
Aws::ShutdownAPI(options);
// Now shut it down a second time. (This call must not crash.)
Aws::ShutdownAPI(options);
// And one more time, for good measure.
Aws::ShutdownAPI(options);
}