desktop/kde-workspace/high_cpu.diff
philm 96fc44d963 merge kde 4.8 to testing
remove some outdated pkgs
2012-02-05 21:46:15 +01:00

58 lines
2.2 KiB
Diff

commit d07964e0af95911a97c3f474b694570cb279878c
Author: Philipp Knechtges <philipp-dev@knechtges.com>
Date: Thu Jan 19 11:38:04 2012 +0100
kwin: fixing high cpu usage bugs
In some unfortunate situations it is possible that a window is deleted
before it is marked ready_for_painting=true. The last point is
especially troublesome for effects that reference the deleted window.
Many thanks to Elias Probst for all the testing.
CCBUG: 290025
CCBUG: 288948
REVIEW: 103733
diff --git a/kwin/deleted.cpp b/kwin/deleted.cpp
index f465159..e166bf1 100644
--- a/kwin/deleted.cpp
+++ b/kwin/deleted.cpp
@@ -66,6 +66,15 @@ void Deleted::copyToDeleted(Toplevel* c)
{
assert(dynamic_cast< Deleted* >(c) == NULL);
Toplevel::copyToDeleted(c);
+ // In some cases the window has been deleted before the sync request which marks
+ // the window ready for painting has finished. This is especially troublesome
+ // when effects reference the deleted window and the unreferencing is part of
+ // the rendering pass (e.g. Effect::postPaintScreen/postPaintWindow), which will
+ // never be executed because we remove it every time from the stacking list in
+ // Workspace::performCompositing.
+ if (!c->readyForPainting()) {
+ QTimer::singleShot(0, this, SLOT(discard()));
+ }
desk = c->desktop();
activityList = c->activities();
contentsRect = QRect(c->clientPos(), c->clientSize());
diff --git a/kwin/deleted.h b/kwin/deleted.h
index 1f98aaf..8101297 100644
--- a/kwin/deleted.h
+++ b/kwin/deleted.h
@@ -35,7 +35,6 @@ public:
// used by effects to keep the window around for e.g. fadeout effects when it's destroyed
void refWindow();
void unrefWindow(bool delay = false);
- void discard(allowed_t);
virtual int desktop() const;
virtual QStringList activities() const;
virtual QPoint clientPos() const;
@@ -58,6 +57,8 @@ public:
}
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
QRect decorationRect() const;
+public slots:
+ void discard(allowed_t = Allowed);
protected:
virtual void debug(QDebug& stream) const;
virtual bool shouldUnredirect() const;