From 93016537ebd01a047fb2531f33c1bd1d54da4ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 8 Jul 2008 17:41:15 +0000 Subject: [PATCH] Check if the Painter even has a clipping region set before trying to take the short cut when no text needs to be rendered. I've seen a crash yesterday in the app_server test environment when the decorater was drawing something, although it may also have been because I had a screwed up objects folder where some objects were not recompiled because I am switching back and forth between two app_server code folders. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26323 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/drawing/DrawingEngine.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/servers/app/drawing/DrawingEngine.cpp b/src/servers/app/drawing/DrawingEngine.cpp index 7f1c85e1c7..85de034ca9 100644 --- a/src/servers/app/drawing/DrawingEngine.cpp +++ b/src/servers/app/drawing/DrawingEngine.cpp @@ -1067,12 +1067,14 @@ DrawingEngine::DrawString(const char* string, int32 length, BPoint penLocation = pt; // try a fast clipping path - float fontSize = fPainter->Font().Size(); - BRect clippingFrame = fPainter->ClippingRegion()->Frame(); - if (pt.x > clippingFrame.right || pt.y + fontSize < clippingFrame.top - || pt.y - fontSize > clippingFrame.bottom) { - penLocation.x += StringWidth(string, length, delta); - return penLocation; + if (fPainter->ClippingRegion()) { + float fontSize = fPainter->Font().Size(); + BRect clippingFrame = fPainter->ClippingRegion()->Frame(); + if (pt.x > clippingFrame.right || pt.y + fontSize < clippingFrame.top + || pt.y - fontSize > clippingFrame.bottom) { + penLocation.x += StringWidth(string, length, delta); + return penLocation; + } } // use a FontCacheRefernece to speed up the second pass of