Fix up incorrect autoDelete use and handling.

Several UI property handlers were incorrectly using the autoDelete feature by calling UnregisterPropertyType and deleting the pointer themselves, which caused double-delete crashes on application shutdown.  PropertyManagerComponent now gracefully handles that condition but also explicitly asserts explaining how the code should be changed, and the "known offenders" have been fixed up to use autoDelete correctly.
This commit is contained in:
mbalfour
2021-05-11 10:25:03 -05:00
parent a009e38064
commit 704443ac89
9 changed files with 41 additions and 45 deletions
@@ -236,17 +236,11 @@ namespace ScriptEventsEditor
moduleConfiguration->RegisterAssetHandler();
}
m_propertyHandlers.emplace_back(AzToolsFramework::RegisterGenericComboBoxHandler<ScriptEventData::VersionedProperty>());
AzToolsFramework::RegisterGenericComboBoxHandler<ScriptEventData::VersionedProperty>();
}
void ScriptEventEditorSystemComponent::Deactivate()
{
for (auto&& propertyHandler : m_propertyHandlers)
{
AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Broadcast(&AzToolsFramework::PropertyTypeRegistrationMessages::UnregisterPropertyType, propertyHandler.get());
}
m_propertyHandlers.clear();
using namespace ScriptEvents;
ScriptEventsSystemComponentImpl* moduleConfiguration = nullptr;
ScriptEventModuleConfigurationRequestBus::BroadcastResult(moduleConfiguration, &ScriptEventModuleConfigurationRequests::GetSystemComponentImpl);