From 7effda48d7c42889e9dd83b43142b9090441ed30 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Sun, 11 Jan 2009 17:31:47 +0000 Subject: [PATCH] Backport r909140: fix a crash (appearing in KSMServer) which is partly a Qt bug and partly an odd SVG. Basically, don't try creating and drawing on a pixmap if we know it will be null in advance. CCBUG: 179978 svn path=/branches/KDE/4.2/kdelibs/; revision=909478 --- framesvg.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/framesvg.cpp b/framesvg.cpp index 6bab48909..0e4422795 100644 --- a/framesvg.cpp +++ b/framesvg.cpp @@ -583,7 +583,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame) } } } else { - if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix + "left")) { + if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(prefix + "left") + && leftHeight > 0 && frame->leftWidth > 0) { QPixmap left(frame->leftWidth, leftHeight); left.fill(Qt::transparent); @@ -594,7 +595,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame) p.drawTiledPixmap(QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), left); } - if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix + "right")) { + if (frame->enabledBorders & FrameSvg::RightBorder && q->hasElement(prefix + "right") && + leftHeight > 0 && frame->rightWidth > 0) { QPixmap right(frame->rightWidth, leftHeight); right.fill(Qt::transparent); @@ -605,7 +607,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame) p.drawTiledPixmap(QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), right); } - if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix + "top")) { + if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix + "top") + && topWidth > 0 && frame->topHeight > 0) { QPixmap top(topWidth, frame->topHeight); top.fill(Qt::transparent); @@ -616,7 +619,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame) p.drawTiledPixmap(QRect(contentLeft, topOffset, contentWidth, frame->topHeight), top); } - if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix + "bottom")) { + if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix + "bottom") + && topWidth > 0 && frame->bottomHeight > 0) { QPixmap bottom(topWidth, frame->bottomHeight); bottom.fill(Qt::transparent);