diff options
author | Will Thompson <will@willthompson.co.uk> | 2012-01-13 16:37:49 +0000 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2012-01-13 16:37:49 +0000 |
commit | fef23bdf2747f997b46c20fa3ae5e7a9e1e8676f (patch) | |
tree | 0f3228e0b396cb1e479d69c2903f47377cf2bbe9 | |
parent | b66df308ac873a0b645977122a587e95df6b1a0d (diff) |
canvas: don't crash if we try to invalidate while unrealized
-rw-r--r-- | Bustle/UI/Canvas.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Bustle/UI/Canvas.hs b/Bustle/UI/Canvas.hs index 22b819b..08d1f07 100644 --- a/Bustle/UI/Canvas.hs +++ b/Bustle/UI/Canvas.hs @@ -124,11 +124,15 @@ canvasInvalidateStripe :: Canvas a -> IO () canvasInvalidateStripe canvas (Stripe y1 y2) = do let layout = canvasLayout canvas - win <- layoutGetDrawWindow layout - (width, _height) <- layoutGetSize layout - let pangoRectangle = Rectangle 0 (floor y1) width (ceiling y2) + realized <- widgetGetRealized layout + + -- We only need to invalidate ourself if we're actually on the screen + when realized $ do + win <- layoutGetDrawWindow layout + (width, _height) <- layoutGetSize layout + let pangoRectangle = Rectangle 0 (floor y1) width (ceiling y2) - drawWindowInvalidateRect win pangoRectangle False + drawWindowInvalidateRect win pangoRectangle False canvasClampAroundSelection :: Canvas a -> IO () |