mirror of https://github.com/Icinga/icinga2.git
Fixed weak ptr deref bug.
This commit is contained in:
parent
5ae2c4aa5b
commit
90c4d6624b
|
@ -59,11 +59,17 @@ void Application::RunEventLoop(void)
|
|||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&exceptfds);
|
||||
|
||||
for (Socket::CollectionType::iterator i = Socket::Sockets.begin(); i != Socket::Sockets.end(); i++) {
|
||||
Socket::CollectionType::iterator prev, i;
|
||||
for (i = Socket::Sockets.begin(); i != Socket::Sockets.end(); ) {
|
||||
Socket::Ptr socket = i->lock();
|
||||
|
||||
if (socket == NULL)
|
||||
prev = i;
|
||||
i++;
|
||||
|
||||
if (!socket) {
|
||||
Socket::Sockets.erase(prev);
|
||||
continue;
|
||||
}
|
||||
|
||||
int fd = socket->GetFD();
|
||||
|
||||
|
@ -106,15 +112,16 @@ void Application::RunEventLoop(void)
|
|||
EventArgs ea;
|
||||
ea.Source = shared_from_this();
|
||||
|
||||
Socket::CollectionType::iterator prev, i;
|
||||
for (i = Socket::Sockets.begin(); i != Socket::Sockets.end(); ) {
|
||||
Socket::Ptr socket = i->lock();
|
||||
|
||||
prev = i;
|
||||
i++;
|
||||
|
||||
Socket::Ptr socket = prev->lock();
|
||||
|
||||
if (socket == NULL)
|
||||
if (!socket) {
|
||||
Socket::Sockets.erase(prev);
|
||||
continue;
|
||||
}
|
||||
|
||||
int fd = socket->GetFD();
|
||||
|
||||
|
|
|
@ -42,12 +42,17 @@ void Timer::CallExpiredTimers(void)
|
|||
|
||||
time(&now);
|
||||
|
||||
for (Timer::CollectionType::iterator i = Timers.begin(); i != Timers.end(); ) {
|
||||
Timer::Ptr timer = Timer::Ptr(*i);
|
||||
Timer::CollectionType::iterator prev, i;
|
||||
for (i = Timers.begin(); i != Timers.end(); ) {
|
||||
Timer::Ptr timer = i->lock();
|
||||
|
||||
prev = i;
|
||||
i++;
|
||||
|
||||
if (timer == NULL)
|
||||
if (!timer) {
|
||||
Timers.erase(prev);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (timer->m_Next <= now) {
|
||||
timer->Call();
|
||||
|
|
Loading…
Reference in New Issue