From 7e60827aabd4446a78d29f4478ae4dfdf99cf07d Mon Sep 17 00:00:00 2001 From: casey Date: Fri, 2 Sep 2016 10:19:05 -0700 Subject: [PATCH] Ensure the OverlayStack is cleared when the app loop finishes. --- src/musikbox/cursespp/App.cpp | 2 ++ src/musikbox/cursespp/OverlayStack.cpp | 4 ++++ src/musikbox/cursespp/OverlayStack.h | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/musikbox/cursespp/App.cpp b/src/musikbox/cursespp/App.cpp index d4e9bb396..1aecb288e 100755 --- a/src/musikbox/cursespp/App.cpp +++ b/src/musikbox/cursespp/App.cpp @@ -230,6 +230,8 @@ void App::Run(ILayoutPtr layout) { MessageQueue::Instance().Dispatch(); } + + overlays.Clear(); } void App::UpdateFocusedWindow(IWindowPtr window) { diff --git a/src/musikbox/cursespp/OverlayStack.cpp b/src/musikbox/cursespp/OverlayStack.cpp index 21297ac47..7722cb0f9 100644 --- a/src/musikbox/cursespp/OverlayStack.cpp +++ b/src/musikbox/cursespp/OverlayStack.cpp @@ -93,4 +93,8 @@ void OverlayStack::Remove(ILayout* layout) { setOverlayStack(*it, nullptr); this->stack.erase(it); } +} + +void OverlayStack::Clear() { + this->stack.clear(); } \ No newline at end of file diff --git a/src/musikbox/cursespp/OverlayStack.h b/src/musikbox/cursespp/OverlayStack.h index e38cadc63..e3cccb62d 100644 --- a/src/musikbox/cursespp/OverlayStack.h +++ b/src/musikbox/cursespp/OverlayStack.h @@ -46,6 +46,10 @@ namespace cursespp { void Remove(ILayoutPtr layout); void Remove(ILayout* layout); + protected: + friend class App; + void Clear(); /* don't want this exposed to the public */ + private: std::vector stack; };