summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Hartmetz <ahartmetz@gmail.com>2018-04-12 21:25:45 +0200
committerAndreas Hartmetz <ahartmetz@gmail.com>2018-09-16 12:31:00 +0000
commit37df81b788ebe700930bbaae90fc720b6dd2f314 (patch)
treef793fcf6f89c2c64d734599a04f5a3b8a5cc0e79
parent6723155bc768790f14d97a61b74b01e7465ba199 (diff)
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>
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 4c780a9294..60b4be81b1 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -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;