forked from qt-creator/qt-creator
CrumblePath: Fix Crash
QWidget::mousePressEvent() closes the widget if the position is not within the rect. A subsequent call to update() amounts to accessing potentially corrupt memory. Hence call update() before calling QWidget::mousePressEvent(). Change-Id: I850471d3a1dfdb0a4f0541a69fd2f239dbf8b5fa Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -173,34 +173,34 @@ void CrumblePathButton::tintImages()
|
||||
|
||||
void CrumblePathButton::leaveEvent(QEvent *e)
|
||||
{
|
||||
QPushButton::leaveEvent(e);
|
||||
m_isHovering = false;
|
||||
update();
|
||||
QPushButton::leaveEvent(e);
|
||||
}
|
||||
|
||||
void CrumblePathButton::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
if (!isEnabled())
|
||||
return;
|
||||
QPushButton::mouseMoveEvent(e);
|
||||
m_isHovering = true;
|
||||
update();
|
||||
QPushButton::mouseMoveEvent(e);
|
||||
}
|
||||
|
||||
void CrumblePathButton::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
if (!isEnabled())
|
||||
return;
|
||||
QPushButton::mousePressEvent(e);
|
||||
m_isPressed = true;
|
||||
update();
|
||||
QPushButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void CrumblePathButton::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
QPushButton::mouseReleaseEvent(e);
|
||||
m_isPressed = false;
|
||||
update();
|
||||
QPushButton::mouseReleaseEvent(e);
|
||||
}
|
||||
|
||||
void CrumblePathButton::changeEvent(QEvent *e)
|
||||
|
Reference in New Issue
Block a user