forked from qt-creator/qt-creator
Editors/Function hint: Guard against potential crashes
Change-Id: I285fe66a2ef9fd9543150dbbec5da6a83657ae73 Task-number: QTCREATORBUG-14875 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <utils/faketooltip.h>
|
#include <utils/faketooltip.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@@ -201,7 +202,8 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
|
|||||||
d->m_escapePressed = true;
|
d->m_escapePressed = true;
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
if (d->m_model->size() > 1) {
|
QTC_CHECK(d->m_model);
|
||||||
|
if (d->m_model && d->m_model->size() > 1) {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
||||||
if (ke->key() == Qt::Key_Up) {
|
if (ke->key() == Qt::Key_Up) {
|
||||||
previousPage();
|
previousPage();
|
||||||
@@ -220,10 +222,13 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
|
|||||||
emit explicitlyAborted();
|
emit explicitlyAborted();
|
||||||
return false;
|
return false;
|
||||||
} else if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) {
|
} else if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) {
|
||||||
if (d->m_model->size() > 1)
|
QTC_CHECK(d->m_model);
|
||||||
|
if (d->m_model && d->m_model->size() > 1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
d->m_assistant->notifyChange();
|
QTC_CHECK(d->m_assistant);
|
||||||
|
if (d->m_assistant)
|
||||||
|
d->m_assistant->notifyChange();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QEvent::WindowDeactivate:
|
case QEvent::WindowDeactivate:
|
||||||
|
|||||||
Reference in New Issue
Block a user