Skip to content

Commit 9833354

Browse files
fix(qt): only reinitialize splash phase on actual phase transition
During wallet rescans, repeated ShowProgress callbacks with the same message re-entered the resetsBar block, slamming displayProgress back to 0 and restarting phaseTimer on every update. Track the current phase pointer and skip reinitialization when the phase hasn't changed.
1 parent 09fc59c commit 9833354

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/qt/splashscreen.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,12 @@ void SplashScreen::showMessage(const QString &message, int alignment, const QCol
354354
animTimer.start(30);
355355
}
356356

357-
// Look up the phase range for this message
357+
// Look up the phase range for this message; only reinitialize when the
358+
// phase actually changes so that repeated progress callbacks (e.g. during
359+
// wallet rescans) don't reset displayProgress and phaseTimer each time.
358360
const PhaseInfo* phase = LookupPhase(message);
359-
if (phase != nullptr) {
361+
if (phase != nullptr && phase != m_current_phase) {
362+
m_current_phase = phase;
360363
if (phase->snapsToEnd) {
361364
// Final phase: snap to 100% immediately since the splash
362365
// will be destroyed moments after "Done loading" arrives

src/qt/splashscreen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public Q_SLOTS:
7575
qreal phaseEnd{0.0}; // Overall progress at end of current phase
7676
bool phaseIsLong{false}; // True for long independent phases (rescan, wallet load)
7777
QElapsedTimer phaseTimer; // Time since current phase started
78+
const struct PhaseInfo* m_current_phase{nullptr}; // Current phase (defined in splashscreen.cpp)
7879
qreal displayProgress{0.0}; // Smoothly animated display value (0.0-1.0)
7980
QTimer animTimer;
8081

0 commit comments

Comments
 (0)