From 8b3a795ea6bcbd83eab83edf75e98c57269aeb6e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 16 Mar 2012 20:31:12 -0400 Subject: [PATCH 1/9] Bugfix: Missing includes --- src/qt/addressbookpage.cpp | 1 + src/qt/transactionview.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 76061233fc8..2c4407a81da 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -4,6 +4,7 @@ #include "addresstablemodel.h" #include "editaddressdialog.h" #include "csvmodelwriter.h" +#include "guiutil.h" #include #include diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 0bfce351a49..1dd4c7b542a 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -10,6 +10,7 @@ #include "transactiondescdialog.h" #include "editaddressdialog.h" #include "optionsmodel.h" +#include "guiutil.h" #include #include From b3ba40c6bf7417f9db6ee67afe388953d0d77e41 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 17 Mar 2012 19:54:22 -0400 Subject: [PATCH 2/9] Move QMAKE_LIBS_QT_ENTRY adjustment to bitcoin side of build It could just as well be on either part of the gitian build, but to safely put it on the Qt side would require bumping the filename, and every gitian user rebuilding it. v0.5.3.1 put it on the Bitcoin side, and this is easier to work with and keep safe, so I'm moving it. --- bitcoin-qt.pro | 1 + contrib/gitian-descriptors/qt-win32.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 64b9670bfde..28eba2b9ea5 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -254,6 +254,7 @@ isEmpty(BOOST_INCLUDE_PATH) { windows:LIBS += -lmingwthrd -lws2_32 windows:DEFINES += _MT WIN32 windows:RC_FILE = src/qt/res/bitcoin-qt.rc +windows:QMAKE_LIBS_QT_ENTRY -= -lmingw32 macx:HEADERS += src/qt/macdockiconhandler.h macx:OBJECTIVE_SOURCES += src/qt/macdockiconhandler.mm diff --git a/contrib/gitian-descriptors/qt-win32.yml b/contrib/gitian-descriptors/qt-win32.yml index adccebbb918..6eb76b21707 100644 --- a/contrib/gitian-descriptors/qt-win32.yml +++ b/contrib/gitian-descriptors/qt-win32.yml @@ -47,7 +47,6 @@ script: | cp -a bin $SRCDIR/ cd $INSTDIR find . -name *.prl | xargs -l sed 's|/$||' -i - sed 's/QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain/QMAKE_LIBS_QT_ENTRY = -lqtmain/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf #sed 's|QMAKE_PRL_LIBS.*|QMAKE_PRL_LIBS = -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lQtXmlPatterns -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtNetwork -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32|' -i imports/Qt/labs/particles/qmlparticlesplugin.prl # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date From 0a1c5c9b104458b3e048c8e3ae5e9f347a5ab399 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 19 Mar 2012 12:15:03 -0400 Subject: [PATCH 3/9] Bump version to 0.5.0.6 --- bitcoin-qt.pro | 2 +- doc/README | 2 +- doc/README_windows.txt | 2 +- share/setup.nsi | 6 +++--- src/serialize.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index 28eba2b9ea5..ff5df982479 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -1,6 +1,6 @@ TEMPLATE = app TARGET = -VERSION = 0.5.0.5 +VERSION = 0.5.0.6 INCLUDEPATH += src src/json src/qt DEFINES += QT_GUI BOOST_THREAD_USE_LIB CONFIG += no_include_pwd diff --git a/doc/README b/doc/README index 9b3c561cbe1..dc296f4e2e5 100644 --- a/doc/README +++ b/doc/README @@ -1,4 +1,4 @@ -Bitcoin 0.5.0.5 BETA +Bitcoin 0.5.0.6 BETA Copyright (c) 2009-2012 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying diff --git a/doc/README_windows.txt b/doc/README_windows.txt index c23b0ea84d5..f373b1449b3 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,4 +1,4 @@ -Bitcoin 0.5.0.5 BETA +Bitcoin 0.5.0.6 BETA Copyright (c) 2009-2012 Bitcoin Developers Distributed under the MIT/X11 software license, see the accompanying diff --git a/share/setup.nsi b/share/setup.nsi index 4f764153e18..c574269bc49 100644 --- a/share/setup.nsi +++ b/share/setup.nsi @@ -5,7 +5,7 @@ SetCompressor /SOLID lzma # General Symbol Definitions !define REGKEY "SOFTWARE\$(^Name)" -!define VERSION 0.5.0.5 +!define VERSION 0.5.0.6 !define COMPANY "Bitcoin project" !define URL http://www.bitcoin.org/ @@ -45,13 +45,13 @@ Var StartMenuGroup !insertmacro MUI_LANGUAGE English # Installer attributes -OutFile bitcoin-0.5.0.5-win32-setup.exe +OutFile bitcoin-0.5.0.6-win32-setup.exe InstallDir $PROGRAMFILES\Bitcoin CRCCheck on XPStyle on BrandingText " " ShowInstDetails show -VIProductVersion 0.5.0.5 +VIProductVersion 0.5.0.6 VIAddVersionKey ProductName Bitcoin VIAddVersionKey ProductVersion "${VERSION}" VIAddVersionKey CompanyName "${COMPANY}" diff --git a/src/serialize.h b/src/serialize.h index f10f933b163..f628510a36e 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -60,7 +60,7 @@ class CDataStream; class CAutoFile; static const unsigned int MAX_SIZE = 0x02000000; -static const int VERSION = 50005; +static const int VERSION = 50006; static const char* pszSubVer = ""; static const bool VERSION_IS_BETA = true; From 00d832756cd1c4574774497dc1232101bea5db96 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 11 Mar 2012 17:57:44 -0400 Subject: [PATCH 4/9] Print wallet load errors (to debug.log) --- src/init.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 079e67b9363..2dccc81bf56 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -398,12 +398,14 @@ bool AppInit2(int argc, char* argv[]) else if (nLoadWalletRet == DB_NEED_REWRITE) { strErrors += _("Wallet needed to be rewritten: restart Bitcoin to complete \n"); + printf("%s", strErrors.c_str()); wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR); return false; } else strErrors += _("Error loading wallet.dat \n"); } + printf("%s", strErrors.c_str()); printf(" wallet %15"PRI64d"ms\n", GetTimeMillis() - nStart); RegisterWallet(pwalletMain); From 1194f003504fa6e9d9f59012ec736ebc7c231360 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 11 Mar 2012 18:07:40 -0400 Subject: [PATCH 5/9] Print more diagnostic info for the various DB_CORRUPT conditions --- src/db.cpp | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/db.cpp b/src/db.cpp index 783b0799639..7f9439bf745 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -798,7 +798,10 @@ int CWalletDB::LoadWallet(CWallet* pwallet) // Get cursor Dbc* pcursor = GetCursor(); if (!pcursor) + { + printf("Error getting wallet database cursor\n"); return DB_CORRUPT; + } loop { @@ -809,7 +812,10 @@ int CWalletDB::LoadWallet(CWallet* pwallet) if (ret == DB_NOTFOUND) break; else if (ret != 0) + { + printf("Error reading next record from wallet database\n"); return DB_CORRUPT; + } // Unserialize // Taking advantage of the fact that pair serialization @@ -879,19 +885,38 @@ int CWalletDB::LoadWallet(CWallet* pwallet) CPrivKey pkey; ssValue >> pkey; key.SetPrivKey(pkey); - if (key.GetPubKey() != vchPubKey || !key.IsValid()) + if (key.GetPubKey() != vchPubKey) + { + printf("Error reading wallet database: CPrivKey pubkey inconsistency\n"); return DB_CORRUPT; + } + if (!key.IsValid()) + { + printf("Error reading wallet database: invalid CPrivKey\n"); + return DB_CORRUPT; + } } else { CWalletKey wkey; ssValue >> wkey; key.SetPrivKey(wkey.vchPrivKey); - if (key.GetPubKey() != vchPubKey || !key.IsValid()) + if (key.GetPubKey() != vchPubKey) + { + printf("Error reading wallet database: CWalletKey pubkey inconsistency\n"); return DB_CORRUPT; + } + if (!key.IsValid()) + { + printf("Error reading wallet database: invalid CWalletKey\n"); + return DB_CORRUPT; + } } if (!pwallet->LoadKey(key)) + { + printf("Error reading wallet database: LoadKey failed\n"); return DB_CORRUPT; + } } else if (strType == "mkey") { @@ -900,7 +925,10 @@ int CWalletDB::LoadWallet(CWallet* pwallet) CMasterKey kMasterKey; ssValue >> kMasterKey; if(pwallet->mapMasterKeys.count(nID) != 0) + { + printf("Error reading wallet database: duplicate CMasterKey id %u\n", nID); return DB_CORRUPT; + } pwallet->mapMasterKeys[nID] = kMasterKey; if (pwallet->nMasterKeyMaxID < nID) pwallet->nMasterKeyMaxID = nID; @@ -912,7 +940,10 @@ int CWalletDB::LoadWallet(CWallet* pwallet) vector vchPrivKey; ssValue >> vchPrivKey; if (!pwallet->LoadCryptedKey(vchPubKey, vchPrivKey)) + { + printf("Error reading wallet database: LoadCryptedKey failed\n"); return DB_CORRUPT; + } fIsEncrypted = true; } else if (strType == "defaultkey") From 0ae535cdb2e331c81b35486ebaae09aa5e80d014 Mon Sep 17 00:00:00 2001 From: Joel Kaartinen Date: Fri, 16 Mar 2012 14:23:59 +0200 Subject: [PATCH 6/9] Make the sendcoins dialog use the configured unit type, even on the first attempt. --- src/qt/sendcoinsentry.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index d98400c2608..caffaaeff28 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -66,6 +66,7 @@ void SendCoinsEntry::on_payTo_textChanged(const QString &address) void SendCoinsEntry::setModel(WalletModel *model) { this->model = model; + clear(); } void SendCoinsEntry::setRemoveEnabled(bool enabled) From e20417c333f86797ed328d990bf284080a69920b Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Fri, 17 Feb 2012 13:50:32 +0100 Subject: [PATCH 7/9] Hide window from taskbar when "minimize to tray" active by making window into Tool window --- src/qt/bitcoingui.cpp | 27 +++++++++------------------ src/qt/bitcoingui.h | 4 ---- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 3c9a773f4e9..ff862cf40e1 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -55,7 +55,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): QMainWindow(parent), clientModel(0), walletModel(0), - dummyWidget(0), encryptWalletAction(0), changePassphraseAction(0), aboutQtAction(0), @@ -85,9 +84,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Create the tray icon (or setup the dock icon) createTrayIcon(); - // Dummy widget used when restoring window state after minimization - dummyWidget = new QWidget(); - // Create tabs overviewPage = new OverviewPage(); @@ -161,7 +157,6 @@ BitcoinGUI::~BitcoinGUI() #ifdef Q_WS_MAC delete appMenuBar; #endif - delete dummyWidget; } void BitcoinGUI::createActions() @@ -387,14 +382,6 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason) } #endif -void BitcoinGUI::showNormal() -{ - // Reparent window to the desktop (in case it was hidden on minimize) - if(parent() != NULL) - setParent(NULL, Qt::Window); - QMainWindow::showNormal(); -} - void BitcoinGUI::optionsClicked() { if(!clientModel || !clientModel->getOptionsModel()) @@ -541,15 +528,19 @@ void BitcoinGUI::changeEvent(QEvent *e) { if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray()) { - if(isMinimized()) + QWindowStateChangeEvent *wsevt = static_cast(e); + bool wasMinimized = wsevt->oldState() & Qt::WindowMinimized; + bool isMinimized = windowState() & Qt::WindowMinimized; + if(!wasMinimized && isMinimized) { - // Hiding the window from taskbar - setParent(dummyWidget, Qt::SubWindow); + // Minimized, hide the window from taskbar + setWindowFlags(windowFlags() | Qt::Tool); return; } - else + else if(wasMinimized && !isMinimized) { - showNormal(); + // Unminimized, show the window in taskbar + setWindowFlags(windowFlags() &~ Qt::Tool); } } } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 1338998a98c..9b672ee809d 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -54,8 +54,6 @@ private: QStackedWidget *centralWidget; - QWidget *dummyWidget; - OverviewPage *overviewPage; QWidget *transactionsPage; AddressBookPage *addressBookPage; @@ -109,8 +107,6 @@ public slots: */ void askFee(qint64 nFeeRequired, bool *payFee); - void showNormal(); - private slots: // UI pages void gotoOverviewPage(); From b4c7b6a384e69ec31ae6067a9b9692fa7b02ab56 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 15 Mar 2012 22:30:08 +0100 Subject: [PATCH 8/9] Yet another attempt at implementing "minimize to tray" that works on all OSes --- src/qt/bitcoingui.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index ff862cf40e1..78becafe5b4 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -523,29 +524,21 @@ void BitcoinGUI::error(const QString &title, const QString &message) void BitcoinGUI::changeEvent(QEvent *e) { + QMainWindow::changeEvent(e); #ifndef Q_WS_MAC // Ignored on Mac if(e->type() == QEvent::WindowStateChange) { if(clientModel && clientModel->getOptionsModel()->getMinimizeToTray()) { QWindowStateChangeEvent *wsevt = static_cast(e); - bool wasMinimized = wsevt->oldState() & Qt::WindowMinimized; - bool isMinimized = windowState() & Qt::WindowMinimized; - if(!wasMinimized && isMinimized) + if(!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) { - // Minimized, hide the window from taskbar - setWindowFlags(windowFlags() | Qt::Tool); - return; - } - else if(wasMinimized && !isMinimized) - { - // Unminimized, show the window in taskbar - setWindowFlags(windowFlags() &~ Qt::Tool); + QTimer::singleShot(0, this, SLOT(hide())); + e->ignore(); } } } #endif - QMainWindow::changeEvent(e); } void BitcoinGUI::closeEvent(QCloseEvent *event) From 0e6c6e3fd1ab971c652e48fa04bac097e44e76fe Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 18 Feb 2012 13:32:25 +0100 Subject: [PATCH 9/9] Workaround for BN_bn2mpi reading/writing out of bounds When OpenSSL's BN_bn2mpi is passed a buffer of size 4, valgrind reports reading/writing one byte past it. I am unable to find evidence of this behaviour in BN_bn2mpi's source code, so it may be a spurious warning. However, this change is harmless, as only the bignum with value 0 results in an mpi serialization of size 4. --- src/bignum.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bignum.h b/src/bignum.h index 1a2406b9358..6e8d3cb8aba 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -243,7 +243,7 @@ public: std::vector getvch() const { unsigned int nSize = BN_bn2mpi(this, NULL); - if (nSize < 4) + if (nSize <= 4) return std::vector(); std::vector vch(nSize); BN_bn2mpi(this, &vch[0]);