Skip to content

Commit e8a4c50

Browse files
PaulPaul
authored andcommitted
deref iterators before calling methods
1 parent e2e7393 commit e8a4c50

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/zmq/zmqnotificationinterface.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool CZMQNotificationInterface::Initialize()
9090
auto it=notifiers.begin();
9191
for (; it!=notifiers.end(); ++it)
9292
{
93-
if (it->Initialize(pcontext))
93+
if ((*it)->Initialize(pcontext))
9494
{
9595
LogPrint("zmq", " Notifier %s ready (address = %s)\n", it->GetType(), it->GetAddress());
9696
}
@@ -118,7 +118,7 @@ void CZMQNotificationInterface::Shutdown()
118118
for (auto it=notifiers.begin(); it!=notifiers.end(); ++it)
119119
{
120120
LogPrint("zmq", " Shutdown notifier %s at %s\n", it->GetType(), it->GetAddress());
121-
it->Shutdown();
121+
(*it)->Shutdown();
122122
}
123123
zmq_ctx_destroy(pcontext);
124124

@@ -133,13 +133,13 @@ void CZMQNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, co
133133

134134
for (auto it = notifiers.begin(); it!=notifiers.end(); )
135135
{
136-
if (it->NotifyBlock(pindexNew))
136+
if ((*it)->NotifyBlock(pindexNew))
137137
{
138138
it++;
139139
}
140140
else
141141
{
142-
it->Shutdown();
142+
(*it)->Shutdown();
143143
it = notifiers.erase(i);
144144
}
145145
}
@@ -149,13 +149,13 @@ void CZMQNotificationInterface::SyncTransaction(const CTransaction& tx, const CB
149149
{
150150
for (auto it = notifiers.begin(); it!=notifiers.end(); )
151151
{
152-
if (it->NotifyTransaction(tx))
152+
if ((*it)->NotifyTransaction(tx))
153153
{
154154
it++;
155155
}
156156
else
157157
{
158-
it->Shutdown();
158+
(*it)->Shutdown();
159159
it = notifiers.erase(i);
160160
}
161161
}
@@ -165,13 +165,13 @@ void CZMQNotificationInterface::NotifyTransactionLock(const CTransaction &tx)
165165
{
166166
for (auto it = notifiers.begin(); it!=notifiers.end(); )
167167
{
168-
if (it->NotifyTransactionLock(tx))
168+
if ((*it)->NotifyTransactionLock(tx))
169169
{
170170
it++;
171171
}
172172
else
173173
{
174-
it->Shutdown();
174+
(*it)->Shutdown();
175175
it = notifiers.erase(i);
176176
}
177177
}
@@ -181,13 +181,13 @@ void CZMQNotificationInterface::NotifyGovernanceVote(const CGovernanceVote &vote
181181
{
182182
for (auto it = notifiers.begin(); it != notifiers.end(); )
183183
{
184-
if (it->NotifyGovernanceVote(vote))
184+
if ((*it)->NotifyGovernanceVote(vote))
185185
{
186186
it++;
187187
}
188188
else
189189
{
190-
it->Shutdown();
190+
(*it)->Shutdown();
191191
it = notifiers.erase(i);
192192
}
193193
}
@@ -197,13 +197,13 @@ void CZMQNotificationInterface::NotifyGovernanceObject(const CGovernanceObject &
197197
{
198198
for (auto it = notifiers.begin(); it != notifiers.end(); )
199199
{
200-
if (it->NotifyGovernanceObject(object))
200+
if ((*it)->NotifyGovernanceObject(object))
201201
{
202202
it++;
203203
}
204204
else
205205
{
206-
it->Shutdown();
206+
(*it)->Shutdown();
207207
it = notifiers.erase(i);
208208
}
209209
}

0 commit comments

Comments
 (0)