diff --git a/ChangeLog.txt b/ChangeLog.txt index f932d5bc2..c3ae00d6a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -211,4 +211,6 @@ using the internal work queues from user space. I have decided to implemented user-space work queues (someday) in order to accomplish that functionaliy. Submitted by Petteri Aimonen. - +* NxWidgets:CText and NxWidgets:CNumericEdite: Fix some memory freeing bugs + (from Petteri Aimonen). + \ No newline at end of file diff --git a/libnxwidgets/src/cnumericedit.cxx b/libnxwidgets/src/cnumericedit.cxx index e0df014c5..993e86fb8 100644 --- a/libnxwidgets/src/cnumericedit.cxx +++ b/libnxwidgets/src/cnumericedit.cxx @@ -158,9 +158,11 @@ CNumericEdit::CNumericEdit(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_ CNumericEdit::~CNumericEdit() { - delete m_label; - delete m_button_minus; - delete m_button_plus; + // CNxWidget destroys all children + + m_label = 0; + m_button_minus = 0; + m_button_plus = 0; } void CNumericEdit::getPreferredDimensions(CRect &rect) const diff --git a/libnxwidgets/src/ctext.cxx b/libnxwidgets/src/ctext.cxx index 688031d88..caa0c02e8 100644 --- a/libnxwidgets/src/ctext.cxx +++ b/libnxwidgets/src/ctext.cxx @@ -276,11 +276,14 @@ const int CText::getLineTrimmedLength(const int lineNumber) const length--; } while (iterator->moveToPrevious() && (length > 0)); + + delete iterator; return length; } // May occur if data has been horribly corrupted somewhere + delete iterator; return 0; }