Print warnings if trying to assign invalid sizes to a panel or trying to generate a panel background with an invalid size. Prevents attempts to paint on an invalid pixmap leading to XRender errors.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=801852
This commit is contained in:
Robert Knight 2008-04-27 22:34:24 +00:00
parent ebdd9d4f99
commit cdb840d200

View File

@ -194,7 +194,10 @@ QString PanelSvg::prefix()
void PanelSvg::resizePanel(const QSizeF& size)
{
if (!size.isValid() || size.width() < 1 || size.height() < 1 || size == d->panels[d->prefix]->panelSize) {
bool sizeValid = size.width() > 0 && size.height() > 0;
if (!sizeValid || size == d->panels[d->prefix]->panelSize) {
if (!sizeValid)
kWarning() << "Invalid size" << size;
return;
}
@ -298,6 +301,11 @@ void PanelSvg::Private::generateBackground(PanelData *panel)
if (panel->cachedBackground) {
return;
}
if (!panel->panelSize.isValid()) {
kWarning() << "Invalid panel size" << panel->panelSize;
panel->cachedBackground = new QPixmap();
return;
}
const int contentWidth = panel->panelSize.width() - panel->leftWidth - panel->rightWidth;
const int contentHeight = panel->panelSize.height() - panel->topHeight - panel->bottomHeight;