Qt: Fix crash when starting to drag on the wrong position

When dragging on the wrong position in the toolbar, wireshark
crashes

Change-Id: I756e9caebc844d32e99e9fd3e338a872986b9e96
Reviewed-on: https://code.wireshark.org/review/28458
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Roland Knall 2018-06-26 10:57:50 -07:00
parent 2d8e8b9574
commit 1437b421a2
1 changed files with 3 additions and 0 deletions

View File

@ -115,6 +115,9 @@ bool DragDropToolBar::eventFilter(QObject * obj, QEvent * event)
if ( ( ev->buttons() & Qt::LeftButton ) && (ev->pos() - dragStartPosition).manhattanLength()
> QApplication::startDragDistance())
{
if ( ! qobject_cast<QToolButton *>(elem) || ! elem->property(drag_drop_toolbar_action_).isValid() )
return QToolBar::eventFilter(obj, event);
ToolbarEntryMimeData * temd =
new ToolbarEntryMimeData(((QToolButton *)elem)->text(), elem->property(drag_drop_toolbar_action_).toInt());
DragLabel * lbl = new DragLabel(temd->labelText(), this);