summaryrefslogtreecommitdiff
path: root/plugins/unityshell
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-09-16 19:47:54 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-09-16 19:47:54 +0200
commita162655badd2c32341fbdd35211bb9c8b73eb056 (patch)
tree8c5b51007bd12d4f2ec041c6ea2f3cc389dbbbbc /plugins/unityshell
parentddd53b3970925478d2b3648259a2789bddd127d3 (diff)
UnityScreen: remove while iterating the animating show-desktop windows
As this is done in donePaint, it's better to optimize things the most we can. (bzr r3506.4.3)
Diffstat (limited to 'plugins/unityshell')
-rw-r--r--plugins/unityshell/src/unityshell.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 848586b29..fc6e4ff86 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -1334,21 +1334,22 @@ void UnityScreen::donePaint()
if (animation_controller_->HasRunningAnimations())
nuxDamageCompiz();
- std::list <ShowdesktopHandlerWindowInterface *> remove_windows;
-
- for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows)
+ for (auto it = ShowdesktopHandler::animating_windows.begin(); it != ShowdesktopHandler::animating_windows.end();)
{
- ShowdesktopHandlerWindowInterface::PostPaintAction action = wi->HandleAnimations (0);
+ auto const& wi = *it;
+ auto action = wi->HandleAnimations(0);
+
if (action == ShowdesktopHandlerWindowInterface::PostPaintAction::Remove)
- remove_windows.push_back(wi);
+ {
+ it = ShowdesktopHandler::animating_windows.erase(it);
+ continue;
+ }
else if (action == ShowdesktopHandlerWindowInterface::PostPaintAction::Damage)
+ {
wi->AddDamage ();
- }
+ }
- for (ShowdesktopHandlerWindowInterface *wi : remove_windows)
- {
- wi->DeleteHandler ();
- ShowdesktopHandler::animating_windows.remove (wi);
+ ++it;
}
cScreen->donePaint ();