QPostEventList: change pointer comparison to integer comparison
authorMarc Mutz <marc.mutz@kdab.com>
Thu, 27 Sep 2012 12:31:12 +0000 (14:31 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 27 Sep 2012 21:51:30 +0000 (23:51 +0200)
This is exactly the type of pointer arithmetics that GCC likes to
miscompile.

Just use offset >= size() (=subtract begin() from both sides).

Change-Id: Ifb13652d7b96bf4c06727d9c965516e95d16ab5c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/thread/qthread_p.h

index 0667a81..268891d 100644 (file)
@@ -114,7 +114,7 @@ public:
         int priority = ev.priority;
         if (isEmpty() ||
             last().priority >= priority ||
-            begin() + insertionOffset >= end()) {
+            insertionOffset >= size()) {
             // optimization: we can simply append if the last event in
             // the queue has higher or equal priority
             append(ev);