summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdiel Janulgue <abdiel.janulgue@nokia.com>2010-05-27 18:03:59 +0300
committerAbdiel Janulgue <abdiel.janulgue@nokia.com>2010-05-27 18:03:59 +0300
commite15d5740e71bf52f8b5ce27af07ca7da32336c0e (patch)
tree62eb42ce3df12f97255e025a2d3caa22a103560d
parent6cda5be7e4dc44540d4e4c59fce0209d888a1ed3 (diff)
Fixes NB#171045 - repeatedly locking/unlocking the device crashes mcompositor
Detail: Watch for windows which has failed XGetWindowAttributes though some crashes still gets triggered by Qt in QEasingCurve::~QEasingCurve() or Xlib XGetWindowProperty() with valid data. RevBy: TrustMe
-rw-r--r--src/mcompositewindow.cpp1
-rw-r--r--src/mcompositewindow.h6
-rw-r--r--src/mtexturepixmapitem_egl.cpp8
-rw-r--r--src/mtexturepixmapitem_p.cpp12
-rw-r--r--src/mtexturepixmapitem_p.h1
5 files changed, 19 insertions, 9 deletions
diff --git a/src/mcompositewindow.cpp b/src/mcompositewindow.cpp
index c9f5b53..95ccc21 100644
--- a/src/mcompositewindow.cpp
+++ b/src/mcompositewindow.cpp
@@ -51,6 +51,7 @@ MCompositeWindow::MCompositeWindow(Qt::HANDLE window, QGraphicsItem *p)
wm_protocols_valid(false),
window_obscured(false),
wmhints(0),
+ attrs(0),
meego_layer(-1),
win_id(window),
window_state(-1)
diff --git a/src/mcompositewindow.h b/src/mcompositewindow.h
index ecde38e..1f17094 100644
--- a/src/mcompositewindow.h
+++ b/src/mcompositewindow.h
@@ -316,6 +316,8 @@ public:
const XWMHints &getWMHints();
+ const XWindowAttributes* windowAttributes() const { return attrs; };
+
/*!
* Returns value of _MEEGO_STACKING_LAYER. The value is between [0, 6].
*/
@@ -375,9 +377,6 @@ protected:
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
-
- XWindowAttributes *attrs;
-
private:
bool thumb_mode;
MCompWindowAnimator *anim;
@@ -407,6 +406,7 @@ private:
bool is_valid;
QRect req_geom;
XWMHints *wmhints;
+ XWindowAttributes *attrs;
int meego_layer;
static bool window_transitioning;
diff --git a/src/mtexturepixmapitem_egl.cpp b/src/mtexturepixmapitem_egl.cpp
index c2964cb..0c54c61 100644
--- a/src/mtexturepixmapitem_egl.cpp
+++ b/src/mtexturepixmapitem_egl.cpp
@@ -122,12 +122,14 @@ EGLDisplay EglResourceManager::dpy = 0;
void MTexturePixmapItem::init()
{
- if (attrs->map_state != IsViewable) {
+ if (isValid() && (windowAttributes()->map_state != IsViewable)) {
qWarning("MTexturePixmapItem::%s(): Failed getting offscreen pixmap",
__func__);
+ d->setValid(false);
return;
- }
-
+ } else if (!isValid())
+ return;
+
if (!d->eglresource)
d->eglresource = new EglResourceManager();
diff --git a/src/mtexturepixmapitem_p.cpp b/src/mtexturepixmapitem_p.cpp
index da7d3c8..83362a2 100644
--- a/src/mtexturepixmapitem_p.cpp
+++ b/src/mtexturepixmapitem_p.cpp
@@ -211,11 +211,12 @@ void MTexturePixmapPrivate::init()
glresource->initVertices(glwidget);
}
- XRenderPictFormat *format = XRenderFindVisualFormat(QX11Info::display(), item->attrs->visual);
+ XRenderPictFormat *format = XRenderFindVisualFormat(QX11Info::display(),
+ item->windowAttributes()->visual);
has_alpha = (format && format->type == PictTypeDirect && format->direct.alphaMask);
- resize(item->attrs->width, item->attrs->height);
- item->setPos(item->attrs->x, item->attrs->y);
+ resize(item->windowAttributes()->width, item->windowAttributes()->height);
+ item->setPos(item->windowAttributes()->x, item->windowAttributes()->y);
}
MTexturePixmapPrivate::MTexturePixmapPrivate(Qt::HANDLE window, QGLWidget *w, MTexturePixmapItem *p)
@@ -294,3 +295,8 @@ bool MTexturePixmapPrivate::hasAlpha() const
{
return has_alpha;
}
+
+void MTexturePixmapPrivate::setValid(bool valid)
+{
+ item->is_valid = valid;
+}
diff --git a/src/mtexturepixmapitem_p.h b/src/mtexturepixmapitem_p.h
index 8dd7812..d597b79 100644
--- a/src/mtexturepixmapitem_p.h
+++ b/src/mtexturepixmapitem_p.h
@@ -59,6 +59,7 @@ public:
void windowRaised();
void drawTexture(const QTransform& transform, const QRectF& drawRect, qreal opacity);
void damageTracking(bool enabled);
+ void setValid(bool valid);
QGLContext *ctx;
QGLWidget *glwidget;