kwin: Initialize QElapsedTimers by calling invalidate()

QElapsedTimer doesn't have a constructor that initializes the
private members. This means that calls to isValid() will depend
on uninitialized data when the timer has never been started.

elapsed() and restart() will also use and return values
computed from uninitialized data.

This fixes several valgrind errors.
This commit is contained in:
Fredrik Höglund 2011-10-29 16:55:56 +02:00
parent 67e79ea13a
commit 44165bb0d1
2 changed files with 3 additions and 0 deletions

View file

@ -98,6 +98,7 @@ Scene::Scene(Workspace* ws)
, lanczos_filter(new LanczosFilter())
, m_overlayWindow(new OverlayWindow())
{
last_time.invalidate(); // Initialize the timer
}
Scene::~Scene()

View file

@ -222,6 +222,8 @@ Workspace::Workspace(bool restore)
// need to create the tabbox before compositing scene is setup
tab_box = new TabBox::TabBox(this);
#endif
nextPaintReference.invalidate(); // Initialize the timer
setupCompositing();
// Compatibility