Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.6.1
-
None
-
Windows
-
734ba1f540aaedc4a3558268bd7350c0b15325a4
Description
If a QGraphicsObject which is a recipient of gesture events gets deleted during a gesture sequence (it has accepted GestureStarted but gets deleted before GestureFinished or GestureCanceled) there will be a crash ("The inferior stopped because it received a signal from the Operating System. Signal name: SIGSEGV, Signal meaning: Segmentation fault") in qgraphicsitem.cpp:
/*! \since 4.6 Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object, 0 otherwise. */ QGraphicsObject *QGraphicsItem::toGraphicsObject() { return d_ptr->isObject ? static_cast<QGraphicsObject *>(this) : 0; // <-- crashes because d_ptr is a null pointer }
Apparently the gesture event dispatching system doesn't take into account that the target may not exist anymore.
NOTE ON THE AUTOTEST:
I was unable to reproduce the exact same crash with the autotest using QTest::touchEvent. The test will nonetheless crash albeit the crash is not the one described above. I was able to reproduce the exact same crash with the autotest when running it on Qt Creator if I inserted a breakpoint somewhere in the gesture event handling function (try line 96 for example). Therefore I have also included a manual test where you can reproduce the crash described above. To do this, press and move within the inner rectangle of the test program.
Attachments
Issue Links
- is required for
-
QTBUG-7920 Symbian4_2010_09
- Closed