summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2013-01-23 15:45:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-24 13:45:01 +0100
commit3a2b3fc0d72fe1e52a7830e03f849963f6b73e02 (patch)
tree31a9fcecfd89a21fa3a0316918a13f84a4df5d8c /src
parent45be71bf7d7c855e74b84d2fabb4e626afc57a22 (diff)
Don't try to render a pixmap when there isn't any.
This happened in cases when QDrag choose not to use a pixmap to represent data in a drag and drop operation. The chain that leads to QPainter errors begins in QBasicDrag::startDrag() where we call setPixmap() with Null pixmap, which later calls updateGeometry() which leads to calling render() before the backing store has been resized. Task-number: QTBUG-29283 Change-Id: I2145159d3f23dbde2cba2ca9aa1788e222aba02a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/dnd/qshapedpixmapdndwindow.cpp4
-rw-r--r--src/platformsupport/dnd/qsimpledrag.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/platformsupport/dnd/qshapedpixmapdndwindow.cpp b/src/platformsupport/dnd/qshapedpixmapdndwindow.cpp
index 67c3cb4701..b3e64b01d0 100644
--- a/src/platformsupport/dnd/qshapedpixmapdndwindow.cpp
+++ b/src/platformsupport/dnd/qshapedpixmapdndwindow.cpp
@@ -91,7 +91,9 @@ void QShapedPixmapWindow::setHotspot(const QPoint &hotspot)
void QShapedPixmapWindow::updateGeometry()
{
QRect rect(QCursor::pos() - m_hotSpot, m_pixmap.size());
- if (m_backingStore->size() != m_pixmap.size())
+ if (m_pixmap.isNull())
+ m_backingStore->resize(QSize(1,1));
+ else if (m_backingStore->size() != m_pixmap.size())
m_backingStore->resize(m_pixmap.size());
setGeometry(rect);
}
diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/platformsupport/dnd/qsimpledrag.cpp
index 3b73380cab..fe0146afc3 100644
--- a/src/platformsupport/dnd/qsimpledrag.cpp
+++ b/src/platformsupport/dnd/qsimpledrag.cpp
@@ -207,6 +207,8 @@ void QBasicDrag::resetDndState(bool /* deleteSource */)
void QBasicDrag::startDrag()
{
+ // ### TODO Check if its really necessary to have m_drag_icon_window
+ // when QDrag is used without a pixmap - QDrag::setPixmap()
if (!m_drag_icon_window)
m_drag_icon_window = new QShapedPixmapWindow();