From 680b361d991c2b5860f64b37e50d612fb92b37df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kimmo=20H=E4m=E4l=E4inen?= Date: Tue, 27 Jul 2010 11:27:14 +0300 Subject: Fixes: NB#181396 - Homescreen does not come up - handle invalid MWindowPropertyCache more gracefully... --- src/mwindowpropertycache.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/mwindowpropertycache.h') diff --git a/src/mwindowpropertycache.h b/src/mwindowpropertycache.h index 4c582e5..ff0d271 100644 --- a/src/mwindowpropertycache.h +++ b/src/mwindowpropertycache.h @@ -56,6 +56,8 @@ public: // this is called on ConfigureNotify void setRealGeometry(const QRect &rect) { + if (!is_valid) + return; if (!xcb_real_geom) xcb_real_geom = xcb_get_geometry_reply(xcb_conn, xcb_real_geom_cookie, 0); @@ -69,7 +71,7 @@ public: shapeRefresh(); } const QRect realGeometry() { - if (!xcb_real_geom) { + if (is_valid && !xcb_real_geom) { xcb_real_geom = xcb_get_geometry_reply(xcb_conn, xcb_real_geom_cookie, 0); if (xcb_real_geom && !real_geom_valid) { @@ -82,6 +84,8 @@ public: } const QRegion &shapeRegion(); void shapeRefresh() { + if (!is_valid) + return; if (!shape_rects_valid) shapeRegion(); shape_rects_valid = false; @@ -119,6 +123,8 @@ public: // used to set the atom list now, for immediate effect in e.g. stacking void setNetWmState(const QList& s) { + if (!is_valid) + return; if (!net_wm_state_valid) // receive the obsolete query netWmState(); @@ -133,9 +139,15 @@ public: bool beingMapped() const { return being_mapped; } void setBeingMapped(bool s) { being_mapped = s; } - bool isMapped() const { return attrs->map_state == XCB_MAP_STATE_VIEWABLE; } + bool isMapped() const { + if (!is_valid || !attrs) + return false; + return attrs->map_state == XCB_MAP_STATE_VIEWABLE; + } void setIsMapped(bool s) { + if (!is_valid || !attrs) + return; // a bit ugly but avoids a round trip to X... if (s) attrs->map_state = XCB_MAP_STATE_VIEWABLE; @@ -154,7 +166,11 @@ public: * Returns whether override_redirect flag was in XWindowAttributes at * object creation time. */ - bool isOverrideRedirect() const { return attrs->override_redirect; } + bool isOverrideRedirect() const { + if (!is_valid || !attrs) + return false; + return attrs->override_redirect; + } const XWMHints &getWMHints(); -- cgit v1.2.3