Fix VisualNavbar Crash on Haiku

This commit is contained in:
Florian Märkl 2021-11-15 15:36:55 +01:00
parent c07ce55581
commit bd4342c4cb
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,8 @@ VisualNavbar::VisualNavbar(MainWindow *main, QWidget *parent)
{
Q_UNUSED(parent);
blockTooltip = false;
setObjectName("visualNavbar");
setWindowTitle(tr("Visual navigation bar"));
// setMovable(false);
@ -240,11 +242,17 @@ void VisualNavbar::on_seekChanged(RVA addr)
void VisualNavbar::mousePressEvent(QMouseEvent *event)
{
if (blockTooltip) {
return;
}
qreal x = qhelpers::mouseEventPos(event).x();
RVA address = localXToAddress(x);
if (address != RVA_INVALID) {
auto tooltipPos = qhelpers::mouseEventGlobalPos(event);
blockTooltip = true; // on Haiku, the below call sometimes triggers another mouseMoveEvent,
// causing infinite recursion
QToolTip::showText(tooltipPos, toolTipForAddress(address), this, this->rect());
blockTooltip = false;
if (event->buttons() & Qt::LeftButton) {
event->accept();
Core()->seek(address);

View File

@ -48,6 +48,7 @@ private:
unsigned int previousWidth = 0;
QList<XToAddress> xToAddress;
bool blockTooltip;
RVA localXToAddress(double x);
double addressToLocalX(RVA address);