]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
resolve build errors & lint warnings
authorgg <chown_tee@proton.me>
Mon, 12 Jan 2026 13:24:03 +0000 (08:24 -0500)
committergg <chown_tee@proton.me>
Mon, 12 Jan 2026 13:24:03 +0000 (08:24 -0500)
src/MainWindow.cpp
src/WindowManager.cpp
src/libwalletqt/Wallet.cpp
src/libwalletqt/Wallet.h
src/utils/Utils.cpp

index d15bf3494655e719120d6b9982bc0117a13cc84e..9282db96ba12ef5643c617b054572d906fc1b94f 100644 (file)
@@ -277,14 +277,8 @@ void MainWindow::initStatusBar() {
         auto *fromDateEdit = new QDateEdit(QDate::currentDate().addDays(-defaultDays));
         fromDateEdit->setCalendarPopup(true);
         fromDateEdit->setDisplayFormat("yyyy-MM-dd");
-        fromDateEdit->setCalendarPopup(true);
-        fromDateEdit->setDisplayFormat("yyyy-MM-dd");
         fromDateEdit->setToolTip(tr("Calculated from 'End date' and day span."));
 
-
-        toDateEdit->setCalendarPopup(true);
-        toDateEdit->setDisplayFormat("yyyy-MM-dd");
-
         auto *infoLabel = new QLabel;
         infoLabel->setWordWrap(true);
         infoLabel->setStyleSheet("QLabel { color: #888; font-size: 11px; }");
@@ -994,17 +988,19 @@ void MainWindow::onSyncStatus(quint64 height, quint64 target, bool daemonSync) {
     } else {
         // Calculate depth
         quint64 blocksLeft = (target > height) ? (target - height) : 0;
-        // Estimate download size in MB: assuming 500 MB for full history,
-        // and we are blocksLeft behind out of (target-1) total blocks (since block 0 is genesis)
-        double approximateSizeMB = 0.0;
+        // Estimate download size
+        QString sizeText;
         if (target > 1) {
              quint64 estimatedBytes = Utils::estimateSyncDataSize(blocksLeft);
              sizeText = Utils::formatBytes(estimatedBytes);
         }
         QString statusMsg = Utils::formatSyncStatus(height, target, daemonSync);
-        // Shows "# blocks remaining (approx. X MB)" to sync
-        // Shows "Wallet sync: # blocks remaining (approx. X MB)"
-        this->setStatusText(QString("%1 (approx. %2)").arg(statusMsg).arg(sizeText));
+        // Show size estimate only if available
+        if (!sizeText.isEmpty()) {
+            this->setStatusText(QString("%1 (approx. %2)").arg(statusMsg).arg(sizeText));
+        } else {
+            this->setStatusText(statusMsg);
+        }
     }
     m_statusLabelStatus->setToolTip(QString("Wallet Height: %1 | Network Tip: %2").arg(height).arg(target));
 }
index 38c4cd971c50f33a7fa29d0cd743962bf0f88fca..b0e50ec28a39072e3063494863772b3c2babe742 100644 (file)
@@ -104,8 +104,12 @@ void WindowManager::close() {
     // Stop Tor manager threads
     torManager()->stop();
 
-    // Wait for all threads in the global thread pool
-    QThreadPool::globalInstance()->waitForDone();
+    // Wait for all threads in the global thread pool with timeout to prevent indefinite blocking
+    if (!QThreadPool::globalInstance()->waitForDone(15000)) {
+        qCritical() << "WindowManager: Thread pool tasks did not complete within 30s timeout. "
+                    << "Forcing exit to prevent use-after-free.";
+        std::_Exit(1);  // Fast exit without cleanup - threads may still hold resources
+    }
 
     for (const auto &window: m_windows) {
         window->close();
index 85ec7399c1b5739aa38acdc4a9b5b7ad6d8022c6..4c079f425e62218a12909856cab76d7cf359cb9c 100644 (file)
@@ -592,10 +592,9 @@ void Wallet::syncDateRange(const QDate &start, const QDate &end) {
     cryptonote::network_type nettype = m_wallet2->nettype();
     QString filename = Utils::getRestoreHeightFilename(static_cast<NetworkType::Type>(nettype));
 
-    auto lookup = RestoreHeightLookup::fromFile(filename, static_cast<NetworkType::Type>(nettype));
+    std::unique_ptr<RestoreHeightLookup> lookup(RestoreHeightLookup::fromFile(filename, static_cast<NetworkType::Type>(nettype)));
     uint64_t startHeight = lookup->dateToHeight(start.startOfDay().toSecsSinceEpoch());
     uint64_t endHeight = lookup->dateToHeight(end.startOfDay().toSecsSinceEpoch());
-    delete lookup;
 
     if (startHeight >= endHeight)
         return;
@@ -621,9 +620,11 @@ void Wallet::fullSync() {
     if (!storedHeight.isEmpty()) {
         originalHeight = storedHeight.toULongLong();
     } else {
-        // Fallback (dangerous if skipped, but better than 0)
+        // Fallback: if skipToTip() was used, this may be the current tip, missing all transactions
         originalHeight = m_wallet2->get_refresh_from_block_height();
->>>>>>> 43ee0e4e (Implement Skip Sync and Data Saving features)
+        qWarning() << "fullSync: No stored creation height found (feather.creation_height). "
+                   << "Falling back to current refresh height:" << originalHeight
+                   << ". This may miss transactions if skipToTip() was previously used.";
     }
 
     m_wallet2->set_refresh_from_block_height(originalHeight);
@@ -672,6 +673,7 @@ bool Wallet::importTransaction(const QString &txid) {
         m_wallet2->scan_tx(txids);
         qInfo() << "Successfully imported transaction:" << txid;
         this->updateBalance();
+        this->history()->refresh();
         return true;
     } catch (const std::exception &e) {
         qWarning() << "Failed to import transaction: " << txid << ", error: " << e.what();
index 8dee43654e127a7b11d01bb519bdd5c63b0b45d1..4b7d3d6b8e2260090e3aad178f20c4cb738b47ab 100644 (file)
@@ -532,8 +532,8 @@ private:
     QTimer *m_storeTimer = nullptr;
     std::set<std::string> m_selectedInputs;
 
-    uint64_t m_stopHeight = 0;
-    bool m_rangeSyncActive = false;
+    std::atomic<quint64> m_stopHeight{0};
+    std::atomic<bool> m_rangeSyncActive{false};
 };
 
 #endif // FEATHER_WALLET_H
index 55260154343ce862c2cfa9d5253335b5d3bb9a2d..a33394857fba0bccdedeb1cabb9c5f159700942b 100644 (file)
@@ -752,6 +752,7 @@ QString getPausedSyncStatus(Wallet *wallet, Nodes *nodes, QString *tooltip) {
         if (tooltip) {
             *tooltip = QString("Wallet Height: %1 | Network Tip: %2").arg(walletHeight).arg(daemonHeight);
         }
+        quint64 blocksBehind = (daemonHeight > startHeight) ? (daemonHeight - startHeight) : 0;
         if (blocksBehind == 0) {
             return "[PAUSED] Sync paused";
         }