[BUG][1.16.00] UiButtonComponent.cpp and in all similar

, , ,

Found some thing. In UiButtonComponent.cpp line 184

    bool UiButtonComponent::HandleReleasedCommon(const AZ::Vector2& point)
{
if (m_isHandlingEvents)
{
// if a C++ callback is registered for OnClick then call it
if (m_onClick)
{
....
}
.....
}
.....
}

If in calling function m_onClick i run “UiElementInterface::DestroyElement” of this button. After some times it will have an error. But If move if (m_onClick) to end of if (m_isHandlingEvents) all will work ok.

    bool UiButtonComponent::HandleReleasedCommon(const AZ::Vector2& point)
{
if (m_isHandlingEvents)
{
.....
// if a C++ callback is registered for OnClick then call it
if (m_onClick)
{
....
}
}
.....
}

And i think it have in all elements were using that sequence of events. I not sure that is correct way to fix that but for me work fine.