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
This commit is contained in:
Alex Merry 2009-01-11 17:31:47 +00:00
parent ef71fa06f4
commit 7effda48d7

View File

@ -583,7 +583,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
} }
} }
} else { } 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); QPixmap left(frame->leftWidth, leftHeight);
left.fill(Qt::transparent); left.fill(Qt::transparent);
@ -594,7 +595,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
p.drawTiledPixmap(QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), left); 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); QPixmap right(frame->rightWidth, leftHeight);
right.fill(Qt::transparent); right.fill(Qt::transparent);
@ -605,7 +607,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
p.drawTiledPixmap(QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), right); 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); QPixmap top(topWidth, frame->topHeight);
top.fill(Qt::transparent); top.fill(Qt::transparent);
@ -616,7 +619,8 @@ void FrameSvgPrivate::generateBackground(FrameData *frame)
p.drawTiledPixmap(QRect(contentLeft, topOffset, contentWidth, frame->topHeight), top); 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); QPixmap bottom(topWidth, frame->bottomHeight);
bottom.fill(Qt::transparent); bottom.fill(Qt::transparent);