GLib event dispatcher: fix iteration in source check in error case

It was accessing the deleted current element in a potentially
reallocated container.

Change-Id: I81d86410907b7b0c20c2edc62ad256315606bc96
Reviewed-by: Andreas Hartmetz <ahartmetz@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Andreas Hartmetz 2018-04-12 21:25:45 +02:00
parent 6723155bc7
commit 37df81b788

View File

@ -86,9 +86,10 @@ static gboolean socketNotifierSourceCheck(GSource *source)
p->pollfd.fd, t[int(p->socketNotifier->type())]);
// ### note, modifies src->pollfds!
p->socketNotifier->setEnabled(false);
i--;
} else {
pending = ((p->pollfd.revents & p->pollfd.events) != 0);
}
pending = ((p->pollfd.revents & p->pollfd.events) != 0);
}
return pending;