path: root/src/widgets
diff options
authorMarc Mutz <>2016-10-11 00:43:29 +0200
committerGiuseppe D'Angelo <>2016-11-08 16:32:42 +0000
commite25f2392eb4a208449c3aa53196c81583dba08dc (patch)
tree7cfaac41e71259ad0ea10c966854ee79875dcefa /src/widgets
parentd7bcdc3a442b99c2caebd4cfd38de67e14090e05 (diff)
QGraphicsWidget: add missing break statement to switch in event()
If the QEvent::GraphicsSceneMousePress case falls through, it does so because d->hasDecoration() == false or the virtual call to windowFrameEvent() returned false. It falls through to the case for QEvent::GraphicsSceneMouseMove, etc, which ensures d->windowData and then checks hasDecoration() again, with some other conditions on top, and calls the same virtual function, windowFrameEvent(), with the same arguments again. Now, it could, theoretically, be possible that that second call would, due to the presence of a windowData that wasn't there before, return true when before it did return false. But the only modification to *this between the calls to windowFrameEvent() is the potential allocation of d->windowData, which, if actually effected, will have d->windowData->grabbedSection == Qt::NoSection, hence windowFrameEvent() won't even be called a second time It is therefore safe to assume that a break was intended here, so add it. Discovered independently be GCC 7 and Coverity. Coverity-Id: 11149 Change-Id: Id708a1689ed0f0c914622e388c456ea4576fda02 Reviewed-by: Edward Welbourne <>
Diffstat (limited to 'src/widgets')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index 125174627d..5a4f96a2aa 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -1449,6 +1449,7 @@ bool QGraphicsWidget::event(QEvent *event)
case QEvent::GraphicsSceneMousePress:
if (d->hasDecoration() && windowFrameEvent(event))
return true;
+ break;
case QEvent::GraphicsSceneMouseMove:
case QEvent::GraphicsSceneMouseRelease:
case QEvent::GraphicsSceneMouseDoubleClick: