diff --git a/src/common/RefreshDeferrer.cpp b/src/common/RefreshDeferrer.cpp index a72cb095..c89ffa86 100644 --- a/src/common/RefreshDeferrer.cpp +++ b/src/common/RefreshDeferrer.cpp @@ -15,6 +15,9 @@ RefreshDeferrer::~RefreshDeferrer() bool RefreshDeferrer::attemptRefresh(RefreshDeferrerParams params) { if (dockWidget->isVisibleToUser()) { + if (acc) { + acc->ignoreParams(params); + } return true; } else { dirty = true; diff --git a/src/widgets/CutterDockWidget.cpp b/src/widgets/CutterDockWidget.cpp index 9ccd67f3..12f995ea 100644 --- a/src/widgets/CutterDockWidget.cpp +++ b/src/widgets/CutterDockWidget.cpp @@ -50,7 +50,6 @@ void CutterDockWidget::updateIsVisibleToUser() return; } isVisibleToUserCurrent = visibleToUser; - qDebug() << this << "isVisibleToUser changed to" << isVisibleToUserCurrent; if (isVisibleToUserCurrent) { emit becameVisibleToUser(); } diff --git a/src/widgets/CutterDockWidget.h b/src/widgets/CutterDockWidget.h index 814d98cf..320b6e5d 100644 --- a/src/widgets/CutterDockWidget.h +++ b/src/widgets/CutterDockWidget.h @@ -26,7 +26,7 @@ signals: private: QAction *action; - bool isVisibleToUserCurrent; + bool isVisibleToUserCurrent = false; void updateIsVisibleToUser(); protected: diff --git a/src/widgets/GraphView.cpp b/src/widgets/GraphView.cpp index 60689397..75e4301c 100644 --- a/src/widgets/GraphView.cpp +++ b/src/widgets/GraphView.cpp @@ -740,18 +740,19 @@ void GraphView::showBlock(GraphBlock *block, bool animated) target_x = std::min(horizontalScrollBar()->maximum(), target_x); target_y = std::min(verticalScrollBar()->maximum(), target_y); if (animated) { - QPropertyAnimation *animation_x = new QPropertyAnimation(horizontalScrollBar(), "value"); + QPropertyAnimation *animation_x = new QPropertyAnimation(horizontalScrollBar(), "value", this); + animation_x->deleteLater(); animation_x->setDuration(500); animation_x->setStartValue(horizontalScrollBar()->value()); animation_x->setEndValue(target_x); animation_x->setEasingCurve(QEasingCurve::InOutQuad); - animation_x->start(); - QPropertyAnimation *animation_y = new QPropertyAnimation(verticalScrollBar(), "value"); + animation_x->start(QAbstractAnimation::DeleteWhenStopped); + QPropertyAnimation *animation_y = new QPropertyAnimation(verticalScrollBar(), "value", this); animation_y->setDuration(500); animation_y->setStartValue(verticalScrollBar()->value()); animation_y->setEndValue(target_y); animation_y->setEasingCurve(QEasingCurve::InOutQuad); - animation_y->start(); + animation_y->start(QAbstractAnimation::DeleteWhenStopped); } else { horizontalScrollBar()->setValue(target_x); verticalScrollBar()->setValue(target_y); diff --git a/src/widgets/HexdumpWidget.cpp b/src/widgets/HexdumpWidget.cpp index f872f1db..fac521cd 100644 --- a/src/widgets/HexdumpWidget.cpp +++ b/src/widgets/HexdumpWidget.cpp @@ -80,6 +80,11 @@ HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) : updateHeaders(); this->setWindowTitle(tr("Hexdump")); + + refreshDeferrer = createReplacingRefreshDeferrer(false, [this](const RVA *offset) { + refresh(offset ? *offset : RVA_INVALID); + }); + connect(&syncAction, SIGNAL(triggered(bool)), this, SLOT(toggleSync())); // Set hexdump context menu @@ -119,12 +124,6 @@ HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) : connect(seekable, &CutterSeekable::seekableSeekChanged, this, &HexdumpWidget::onSeekChanged); connect(&rangeDialog, &QDialog::accepted, this, &HexdumpWidget::on_rangeDialogAccepted); - connect(this, &CutterDockWidget::becameVisibleToUser, this, [this]() { - if (hexdumpDirty) { - refresh(); - } - }); - format = Format::Hex; initParsing(); selectHexPreview(); @@ -320,11 +319,8 @@ void HexdumpWidget::highlightHexWords(const QString &str) void HexdumpWidget::refresh(RVA addr) { - if (!isVisibleToUser()) { - hexdumpDirty = true; + if (!refreshDeferrer->attemptRefresh(addr == RVA_INVALID ? nullptr : new RVA(addr))) { return; - } else { - hexdumpDirty = false; } ut64 loadLines = 0; diff --git a/src/widgets/HexdumpWidget.h b/src/widgets/HexdumpWidget.h index e9e32a54..48a2dc62 100644 --- a/src/widgets/HexdumpWidget.h +++ b/src/widgets/HexdumpWidget.h @@ -21,6 +21,8 @@ #include "ui_HexdumpWidget.h" +class RefreshDeferrer; + class HexdumpWidget : public CutterDockWidget { Q_OBJECT @@ -71,7 +73,7 @@ private: RVA first_loaded_address = RVA_INVALID; RVA last_loaded_address = RVA_INVALID; - bool hexdumpDirty = false; + RefreshDeferrer *refreshDeferrer; void refresh(RVA addr = RVA_INVALID); void selectHexPreview(); diff --git a/src/widgets/Omnibar.cpp b/src/widgets/Omnibar.cpp index e52692f7..d6127138 100644 --- a/src/widgets/Omnibar.cpp +++ b/src/widgets/Omnibar.cpp @@ -50,6 +50,9 @@ void Omnibar::refresh(const QStringList &flagList) void Omnibar::restoreCompleter() { QCompleter *completer = this->completer(); + if (!completer) { + return; + } completer->setFilterMode(Qt::MatchContains); }