stop leaking idobj memory (and coloredit layout mem)
This commit is contained in:
@@ -47,7 +47,9 @@ class PD_API ColorEdit : public Container {
|
|||||||
this->initial_color = *color;
|
this->initial_color = *color;
|
||||||
this->tdim = io.Font->GetTextBounds(label.c_str(), io.FontScale);
|
this->tdim = io.Font->GetTextBounds(label.c_str(), io.FontScale);
|
||||||
}
|
}
|
||||||
~ColorEdit() = default;
|
~ColorEdit() {
|
||||||
|
if (layout) delete layout;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override for the Input Handler
|
* Override for the Input Handler
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PD_API Layout {
|
|||||||
Size = 0;
|
Size = 0;
|
||||||
WorkRect = fvec4(IO.MenuPadding, Size - (fvec2(2) * IO.MenuPadding));
|
WorkRect = fvec4(IO.MenuPadding, Size - (fvec2(2) * IO.MenuPadding));
|
||||||
}
|
}
|
||||||
~Layout() = default;
|
~Layout();
|
||||||
|
|
||||||
/** SECTION CONTAINERS */
|
/** SECTION CONTAINERS */
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,15 @@ SOFTWARE.
|
|||||||
|
|
||||||
namespace PD {
|
namespace PD {
|
||||||
namespace UI7 {
|
namespace UI7 {
|
||||||
|
|
||||||
|
PD_API Layout::~Layout() {
|
||||||
|
// We all love managing memory i guess
|
||||||
|
for (Container* obj : IDObjects) {
|
||||||
|
delete obj;
|
||||||
|
}
|
||||||
|
IDObjects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
PD_API void Layout::CursorInit() { Cursor = fvec2(WorkRect.x, WorkRect.y); }
|
PD_API void Layout::CursorInit() { Cursor = fvec2(WorkRect.x, WorkRect.y); }
|
||||||
|
|
||||||
PD_API void Layout::SameLine() {
|
PD_API void Layout::SameLine() {
|
||||||
@@ -136,6 +145,7 @@ PD_API void Layout::Update() {
|
|||||||
|
|
||||||
for (auto it = IDObjects.begin(); it != IDObjects.end();) {
|
for (auto it = IDObjects.begin(); it != IDObjects.end();) {
|
||||||
if ((*it)->Removable()) {
|
if ((*it)->Removable()) {
|
||||||
|
delete *it;
|
||||||
it = IDObjects.erase(it);
|
it = IDObjects.erase(it);
|
||||||
} else {
|
} else {
|
||||||
it++;
|
it++;
|
||||||
|
|||||||
Reference in New Issue
Block a user