Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
5.15
-
None
Description
void QGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
build a QGraphicsItemGroup and select it, then cliek one of the item in this QGraphicsItemGroup ,the mouseReleaseEvent will crash
source code is:
void QGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton && (flags() & ItemIsSelectable)) { bool multiSelect = (event->modifiers() & Qt::ControlModifier) != 0; if (event->scenePos() == event->buttonDownScenePos(Qt::LeftButton)) { // The item didn't move if (multiSelect) { setSelected(!isSelected()); } else { bool selectionChanged = false; if (QGraphicsScene *scene = d_ptr->scene) { ++scene->d_func()->selectionChanging; // Clear everything but this item. Bypass // QGraphicsScene::clearSelection()'s default behavior by // temporarily removing this item from the selection list. if (d_ptr->selected) { scene->d_func()->selectedItems.remove(this); foreach (QGraphicsItem *item, scene->d_func()->selectedItems) { if (item->isSelected()) { selectionChanged = true; break; } } } scene->clearSelection(); if (d_ptr->selected) scene->d_func()->selectedItems.insert(this); --scene->d_func()->selectionChanging; if (selectionChanged) emit d_ptr->scene->selectionChanged(); } setSelected(true); } } } if (d_ptr->scene && !event->buttons()) d_ptr->scene->d_func()->movingItemsInitialPositions.clear(); }
because d_ptr->scene is set null, so emit d_ptr->scene->selectionChanged() will crash