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>
This commit is contained in:
parent
45be71bf7d
commit
3a2b3fc0d7
@ -91,7 +91,9 @@ void QShapedPixmapWindow::setHotspot(const QPoint &hotspot)
|
|||||||
void QShapedPixmapWindow::updateGeometry()
|
void QShapedPixmapWindow::updateGeometry()
|
||||||
{
|
{
|
||||||
QRect rect(QCursor::pos() - m_hotSpot, m_pixmap.size());
|
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());
|
m_backingStore->resize(m_pixmap.size());
|
||||||
setGeometry(rect);
|
setGeometry(rect);
|
||||||
}
|
}
|
||||||
|
@ -207,6 +207,8 @@ void QBasicDrag::resetDndState(bool /* deleteSource */)
|
|||||||
|
|
||||||
void QBasicDrag::startDrag()
|
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)
|
if (!m_drag_icon_window)
|
||||||
m_drag_icon_window = new QShapedPixmapWindow();
|
m_drag_icon_window = new QShapedPixmapWindow();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user