Skip to content

Commit

Permalink
Fixed Crash on exit when layout got docked and undocked (t7do5GhLPP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Jul 22, 2023
1 parent cda8a64 commit 45561de
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Src/ssGUI/Extensions/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,25 @@ namespace Extensions
if(!child->IsEventCallbackExist(ssGUI::Enums::EventType::MIN_MAX_SIZE_CHANGED))
child->AddEventCallback(ssGUI::Enums::EventType::MIN_MAX_SIZE_CHANGED);

ssGUIObjectIndex containerId = child->GetEventCallback(ssGUI::Enums::EventType::MIN_MAX_SIZE_CHANGED)->AddObjectReference(Container);
child->GetEventCallback(ssGUI::Enums::EventType::MIN_MAX_SIZE_CHANGED)->AddEventListener
(
EXTENSION_NAME,
[this](ssGUI::EventInfo& info){Internal_OnChildMinMaxSizeChanged(info.EventSource);} //TODO: Use ObjectsReferences instead of this
Container,
[containerId](ssGUI::EventInfo& info)
{
ssGUI::GUIObject* layoutContainer = info.References->GetObjectReference(containerId);

if(layoutContainer == nullptr)
{
info.DeleteCurrentListener = true;
return;
}

if(layoutContainer->IsAnyExtensionExist<ssGUI::Extensions::Layout>())
layoutContainer ->GetAnyExtension<ssGUI::Extensions::Layout>()
->Internal_OnChildMinMaxSizeChanged(info.EventSource);
}
// std::bind(&ssGUI::Extensions::Layout::Internal_OnChildMinMaxSizeChanged, this, std::placeholders::_1)
);
}
Expand Down

0 comments on commit 45561de

Please sign in to comment.