diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-06-29 12:58:57 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-06-29 12:58:57 +0300 |
commit | 9298f2a4e52d8b011b19331041455a45d57678b6 (patch) | |
tree | e60a89f4ef6ed4a75c79adc49250602a386e169a /src/Display/Display.cpp | |
parent | 60a2067eaac8fa64473c3068caaca5e7902817d7 (diff) |
Refactored swap-and-delete operations
Diffstat (limited to 'src/Display/Display.cpp')
-rw-r--r-- | src/Display/Display.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp index e27c8c48..5929137f 100644 --- a/src/Display/Display.cpp +++ b/src/Display/Display.cpp @@ -195,17 +195,9 @@ GCodeResult Display::Configure(GCodeBuffer& gb, const StringRef& reply) THROWS(G if (gb.Seen('P')) { // Delete any existing LCD, menu and encoder - Lcd *tempLcd = nullptr; - std::swap(lcd, tempLcd); - delete tempLcd; - - Menu *tempMenu = nullptr; - std::swap(menu, tempMenu); - delete tempMenu; - - RotaryEncoder *tempEncoder = nullptr; - std::swap(encoder, tempEncoder); - delete tempEncoder; + DeleteObject(lcd); + DeleteObject(menu); + DeleteObject(encoder); seen = true; switch (gb.GetUIValue()) |