diff --git a/src/Magnum/Platform/ScreenedApplication.hpp b/src/Magnum/Platform/ScreenedApplication.hpp index 3ec90ec9d..e2ef62e1a 100644 --- a/src/Magnum/Platform/ScreenedApplication.hpp +++ b/src/Magnum/Platform/ScreenedApplication.hpp @@ -149,6 +149,9 @@ template BasicScreenedApplication::BasicScreened template BasicScreenedApplication::~BasicScreenedApplication() = default; template BasicScreenedApplication& BasicScreenedApplication::addScreen(BasicScreen& screen) { + CORRADE_ASSERT(!screen.application(), + "Platform::ScreenedApplication::addScreen(): screen already added to an application", *this); + /* A subset of this (except focusEvent()) is done in BasicScreen(BasicScreenedApplication&, PropagatedEvents) as well. Keep in sync. */ @@ -159,6 +162,9 @@ template BasicScreenedApplication& BasicScreened } template BasicScreenedApplication& BasicScreenedApplication::removeScreen(BasicScreen& screen) { + CORRADE_ASSERT(screen.application() == this, + "Platform::ScreenedApplication::removeScreen(): screen not owned by this application", *this); + screen.blurEvent(); Containers::LinkedList>::erase(&screen); Application::redraw(); @@ -166,6 +172,9 @@ template BasicScreenedApplication& BasicScreened } template BasicScreenedApplication& BasicScreenedApplication::focusScreen(BasicScreen& screen) { + CORRADE_ASSERT(screen.application() == this, + "Platform::ScreenedApplication::focusScreen(): screen not owned by this application", *this); + /* Already focused, nothing to do */ if(screens().first() == &screen) return *this;