Skip to content

Commit

Permalink
Merge pull request #279 from adriengivry/fix/HardwareInfo_widgets_leak
Browse files Browse the repository at this point in the history
Fixing HardwareInfo panel memory leak
  • Loading branch information
maxbrundev authored Dec 7, 2023
2 parents a6aa0ea + 95db543 commit c9cceeb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/Overload/OvUI/include/OvUI/Internal/WidgetContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ namespace OvUI::Internal
class WidgetContainer
{
public:
/**
* Constructor
*/
WidgetContainer() = default;

/**
* Destructor. Handle the memory de-allocation of every widgets that are internally managed
*/
virtual ~WidgetContainer();

/**
* Remove a widget from the container
* @param p_widget
Expand Down
5 changes: 5 additions & 0 deletions Sources/Overload/OvUI/src/OvUI/Internal/WidgetContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

#include "OvUI/Internal/WidgetContainer.h"

OvUI::Internal::WidgetContainer::~WidgetContainer()
{
RemoveAllWidgets();
}

void OvUI::Internal::WidgetContainer::RemoveWidget(Widgets::AWidget& p_widget)
{
auto found = std::find_if(m_widgets.begin(), m_widgets.end(), [&p_widget](std::pair<OvUI::Widgets::AWidget*, Internal::EMemoryMode>& p_pair)
Expand Down

0 comments on commit c9cceeb

Please sign in to comment.