Commit a8a2c080 authored by David Faure's avatar David Faure

KFileWidget: fix crash on FreeBSD (from the destructor)

KFileWidget::eventFilter()
(QEvent::Destroy event)
QWidget::~QWidget()
KDirOperator::~KDirOperator
KFileWidgetPrivate::~KFileWidgetPrivate
KFileWidget::~KFileWidget

In that event filter, the d pointer is in the process of being deleted,
better not use it. The event filter is only about key events anyway,
skip it for everything else.
parent d0df7a02
...@@ -1849,33 +1849,35 @@ bool KFileWidget::eventFilter(QObject *watched, QEvent *event) ...@@ -1849,33 +1849,35 @@ bool KFileWidget::eventFilter(QObject *watched, QEvent *event)
const bool res = QWidget::eventFilter(watched, event); const bool res = QWidget::eventFilter(watched, event);
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event); QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
if (watched == d->m_iconSizeSlider && keyEvent) { if (keyEvent) {
if (keyEvent->key() == Qt::Key_Left || keyEvent->key() == Qt::Key_Up || if (watched == d->m_iconSizeSlider) {
keyEvent->key() == Qt::Key_Right || keyEvent->key() == Qt::Key_Down) { if (keyEvent->key() == Qt::Key_Left || keyEvent->key() == Qt::Key_Up ||
d->slotIconSizeSliderMoved(d->m_iconSizeSlider->value()); keyEvent->key() == Qt::Key_Right || keyEvent->key() == Qt::Key_Down) {
} d->slotIconSizeSliderMoved(d->m_iconSizeSlider->value());
} else if (watched == d->m_locationEdit && event->type() == QEvent::KeyPress) { }
if (keyEvent->modifiers() & Qt::AltModifier) { } else if (watched == d->m_locationEdit && event->type() == QEvent::KeyPress) {
switch (keyEvent->key()) { if (keyEvent->modifiers() & Qt::AltModifier) {
case Qt::Key_Up: switch (keyEvent->key()) {
d->m_ops->actionCollection()->action(QStringLiteral("up"))->trigger(); case Qt::Key_Up:
break; d->m_ops->actionCollection()->action(QStringLiteral("up"))->trigger();
case Qt::Key_Left: break;
d->m_ops->actionCollection()->action(QStringLiteral("back"))->trigger(); case Qt::Key_Left:
break; d->m_ops->actionCollection()->action(QStringLiteral("back"))->trigger();
case Qt::Key_Right: break;
d->m_ops->actionCollection()->action(QStringLiteral("forward"))->trigger(); case Qt::Key_Right:
break; d->m_ops->actionCollection()->action(QStringLiteral("forward"))->trigger();
default: break;
break; default:
break;
}
} }
} else if (watched == d->m_ops && event->type() == QEvent::KeyPress &&
(keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter)) {
// ignore return events from the KDirOperator
// they are not needed, activated is used to handle this case
event->accept();
return true;
} }
} else if (watched == d->m_ops && event->type() == QEvent::KeyPress &&
(keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter)) {
// ignore return events from the KDirOperator
// they are not needed, activated is used to handle this case
event->accept();
return true;
} }
return res; return res;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment