[Interest] simple crash with QGraphicsScene
Patrick Stinson
patrickkidd at gmail.com
Sat Jul 29 11:07:32 CEST 2017
Hello! I have reproduced a crash with QGraphicsView where you:
- add a single item in the middle of the scene,
- resize (shrink) the window with the mouse so the item is not fully visible
- resize (grow) the window again
- ***the issue happens right when item is fully visible again.***
Any idea how to work around this? I don’t know enough about QWidgetBackingStore and the gui kernel to debug this and my diagramming app is crashing randomly when the scene is not in view.
Thanks!
CONSOLE OUTPUT
======================================
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::setCompositionMode: Painter not active
QPaintDevice: Cannot destroy paint device that is being painted
STACK TRACE
======================================
#0 0x000000010a2f09fe in QPainter::begin(QPaintDevice*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/gui/painting/qpainter.cpp:1707
#1 0x000000010a2f094a in QPainter::QPainter(QPaintDevice*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/gui/painting/qpainter.cpp:1476
#2 0x000000010a2ed5bd in QPainter::QPainter(QPaintDevice*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/gui/painting/qpainter.cpp:1472
#3 0x000000010de4d4f5 in QRasterBackingStore::beginPaint(QRegion const&) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/platformsupport/graphics/qrasterbackingstore.cpp:124
#4 0x000000010a236f8b in QBackingStore::beginPaint(QRegion const&) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/gui/painting/qbackingstore.cpp:176
#5 0x000000010937a152 in QWidgetBackingStore::beginPaint(QRegion&, QWidget*, QBackingStore*, BeginPaintInfo*, bool) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qwidgetbackingstore.cpp:335
#6 0x000000010938088e in QWidgetBackingStore::doSync() at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qwidgetbackingstore.cpp:1335
#7 0x000000010937effc in QWidgetBackingStore::sync() at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qwidgetbackingstore.cpp:1156
#8 0x00000001093ad4b3 in QWidgetPrivate::syncBackingStore() at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qwidget.cpp:1970
#9 0x00000001093c1fd7 in QWidget::event(QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qwidget.cpp:9107
#10 0x000000010952141b in QFrame::event(QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/widgets/qframe.cpp:550
#11 0x00000001095dbb0e in QAbstractScrollArea::event(QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/widgets/qabstractscrollarea.cpp:1153
#12 0x00000001098357cf in QGraphicsView::event(QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/graphicsview/qgraphicsview.cpp:2849
#13 0x0000000108ba9cd3 in sipQGraphicsView::event(QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-dev/build/PyQt5_gpl-5.8/QtWidgets/sipQtWidgetspart0.cpp:184236
#14 0x000000010936831f in QApplicationPrivate::notify_helper(QObject*, QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qapplication.cpp:3722
#15 0x000000010936d549 in QApplication::notify(QObject*, QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/widgets/kernel/qapplication.cpp:3685
#16 0x0000000108c2d278 in sipQApplication::notify(QObject*, QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-dev/build/PyQt5_gpl-5.8/QtWidgets/sipQtWidgetspart0.cpp:308213
#17 0x000000010811f575 in QCoreApplication::notifyInternal2(QObject*, QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/corelib/kernel/qcoreapplication.cpp:1018
#18 0x0000000108120f28 in QCoreApplication::sendEvent(QObject*, QEvent*) at /Users/patrick/dev/vendor/pyqt-sysroot-dev/build/qt5/qtbase/src/corelib/.moc/../../../../../../../pyqt-sysroot-base/src/qt5-src/qtbase/src/corelib/kernel/qcoreapplication.h:234
#19 0x0000000108120dae in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/corelib/kernel/qcoreapplication.cpp:1693
#20 0x000000010812000f in QCoreApplication::sendPostedEvents(QObject*, int) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/corelib/kernel/qcoreapplication.cpp:1547
#21 0x000000010dd029ae in QCocoaEventDispatcherPrivate::processPostedEvents() at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm:887
#22 0x000000010dd0385f in QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) at /Users/patrick/dev/vendor/pyqt-sysroot-base/src/qt5-src/qtbase/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm:909
CODE
======================================
import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
def test_graphics():
""" Demonstrate simple crash when putting an item out of view when resizing the window. """
app = QApplication(sys.argv)
s = QGraphicsScene()
text = QGraphicsTextItem()
text.setPlainText('here we are')
text.setTextInteractionFlags(Qt.TextEditorInteraction)
text.setPos(0, 0)
s.addItem(text)
w = QGraphicsView()
w.setScene(s)
w.centerOn(QPointF(0, 0))
w.show()
w.resize(300, 300)
app.exec()
w = None # also prevents another bug where abort() from QApplication::style() because isActiveWindow() is called from setScene(NULL)
test_graphics()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1403 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170729/c3e6d846/attachment.bin>
More information about the Interest
mailing list