Skip to content

Commit 178cd88

Browse files
committed
Qt/splash: Specifically keep track of which wallet(s) we are connected to for later disconnecting
1 parent 1880aeb commit 178cd88

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/qt/splashscreen.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr
151151
}
152152

153153
#ifdef ENABLE_WALLET
154-
static void ConnectWallet(SplashScreen *splash, CWallet* wallet)
154+
void SplashScreen::ConnectWallet(CWallet* wallet)
155155
{
156-
wallet->ShowProgress.connect(boost::bind(ShowProgress, splash, _1, _2));
156+
wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
157+
connectedWallets.push_back(wallet);
157158
}
158159
#endif
159160

@@ -163,7 +164,7 @@ void SplashScreen::subscribeToCoreSignals()
163164
uiInterface.InitMessage.connect(boost::bind(InitMessage, this, _1));
164165
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
165166
#ifdef ENABLE_WALLET
166-
uiInterface.LoadWallet.connect(boost::bind(ConnectWallet, this, _1));
167+
uiInterface.LoadWallet.connect(boost::bind(&SplashScreen::ConnectWallet, this, _1));
167168
#endif
168169
}
169170

@@ -173,8 +174,9 @@ void SplashScreen::unsubscribeFromCoreSignals()
173174
uiInterface.InitMessage.disconnect(boost::bind(InitMessage, this, _1));
174175
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
175176
#ifdef ENABLE_WALLET
176-
if(pwalletMain)
177-
pwalletMain->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
177+
Q_FOREACH(CWallet* const & pwallet, connectedWallets) {
178+
pwallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
179+
}
178180
#endif
179181
}
180182

src/qt/splashscreen.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <QSplashScreen>
99

10+
class CWallet;
1011
class NetworkStyle;
1112

1213
/** Class for the splashscreen with information of the running client.
@@ -39,11 +40,15 @@ public Q_SLOTS:
3940
void subscribeToCoreSignals();
4041
/** Disconnect core signals to splash screen */
4142
void unsubscribeFromCoreSignals();
43+
/** Connect wallet signals to splash screen */
44+
void ConnectWallet(CWallet*);
4245

4346
QPixmap pixmap;
4447
QString curMessage;
4548
QColor curColor;
4649
int curAlignment;
50+
51+
QList<CWallet*> connectedWallets;
4752
};
4853

4954
#endif // BITCOIN_QT_SPLASHSCREEN_H

0 commit comments

Comments
 (0)