Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-09-21 11:21:19 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-09-21 11:21:19 +0300
commita333a4768eebd64bc7621a1b226baa40b4a9966b (patch)
tree183ed297c4c343a41b10f8edfd67d998ce31230c /src/Display
parentd25b5cf394f0c678b747fa0753300541c5cf2da1 (diff)
Fixed memoy leak when M918 used multiple times
Diffstat (limited to 'src/Display')
-rw-r--r--src/Display/Display.cpp2
-rw-r--r--src/Display/Menu.cpp5
-rw-r--r--src/Display/Menu.h2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp
index 5cffd5d1..28ab7dfe 100644
--- a/src/Display/Display.cpp
+++ b/src/Display/Display.cpp
@@ -165,8 +165,6 @@ void Display::InitDisplay(GCodeBuffer& gb, Lcd *newLcd, Pin csPin, Pin a0Pin, bo
GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException)
{
- // BUG: calling M918 a number of times in succession seems to crash the firmware on the Maestro.
- // This could be unreleased memory or something else.
bool seen = false;
if (gb.Seen('P'))
diff --git a/src/Display/Menu.cpp b/src/Display/Menu.cpp
index 0787355e..5243354f 100644
--- a/src/Display/Menu.cpp
+++ b/src/Display/Menu.cpp
@@ -90,6 +90,11 @@ Menu::Menu(Lcd& refLcd) noexcept
{
}
+Menu::~Menu()
+{
+ ResetCache(); // this releases the memory used by the menu items
+}
+
void Menu::Load(const char* filename) noexcept
{
if (numNestedMenus < MaxMenuNesting)
diff --git a/src/Display/Menu.h b/src/Display/Menu.h
index 02d64a1a..ec83c139 100644
--- a/src/Display/Menu.h
+++ b/src/Display/Menu.h
@@ -22,6 +22,8 @@ class Menu
{
public:
Menu(Lcd& refLcd) noexcept;
+ ~Menu();
+
void Load(const char* filename) noexcept; // load a menu file
void Pop() noexcept;
void EncoderAction(int action) noexcept;