Fix crasher with 0x0 windows

It can happen that the visualParent has no window attached, so don't
access it. In this case, use the visualParent's geometry.
This commit is contained in:
Sebastian Kügler 2013-04-30 02:33:17 +02:00
parent 20aa17dfe7
commit e4976005c6

View File

@ -152,7 +152,11 @@ void DialogProxy::setVisible(const bool visible)
if (visible) { if (visible) {
syncToMainItemSize(); syncToMainItemSize();
if (!m_visualParent.isNull()) { if (!m_visualParent.isNull()) {
if (m_visualParent.data()->window()) {
avail = m_visualParent.data()->window()->screen()->availableGeometry(); avail = m_visualParent.data()->window()->screen()->availableGeometry();
} else {
avail = QRect(m_visualParent.data()->x(), m_visualParent.data()->y(), m_visualParent.data()->width(), m_visualParent.data()->height());
}
if (location() == Plasma::FullScreen) { if (location() == Plasma::FullScreen) {
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder); m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
setGeometry(avail); setGeometry(avail);