summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-06-29 03:47:26 +0100
committerDylan Baker <dylan@pnwbakers.com>2018-07-05 10:00:02 -0700
commit83716106b9f37b13277e513d8285de9b2440e779 (patch)
tree93343b03f5a8ec1a29cf37ba20566e4ca8a4608b
parent81af1a0ae264378408232dc1e54b00a7dff3529b (diff)
r600/sb: cleanup if_conversion iterator to be legal C++
The current code causes: /usr/include/c++/8/debug/safe_iterator.h:207: Error: attempt to copy from a singular iterator. This is due to the iterators getting invalidated, fix the reverse iterator to use the return value from erase, and cast it properly. (used Mathias suggestion) Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de> (cherry picked from commit 8c51caab2404c5c9f5211936d27e9fe1c0af2e7d)
-rw-r--r--src/gallium/drivers/r600/sb/sb_if_conversion.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_if_conversion.cpp b/src/gallium/drivers/r600/sb/sb_if_conversion.cpp
index 3f6431b80f..017153434f 100644
--- a/src/gallium/drivers/r600/sb/sb_if_conversion.cpp
+++ b/src/gallium/drivers/r600/sb/sb_if_conversion.cpp
@@ -42,16 +42,13 @@ int if_conversion::run() {
regions_vec &rv = sh.get_regions();
unsigned converted = 0;
-
- for (regions_vec::reverse_iterator N, I = rv.rbegin(), E = rv.rend();
- I != E; I = N) {
- N = I; ++N;
-
+ for (regions_vec::reverse_iterator I = rv.rbegin(); I != rv.rend(); ) {
region_node *r = *I;
if (run_on(r)) {
- rv.erase(I.base() - 1);
+ I = regions_vec::reverse_iterator(rv.erase((++I).base()));
++converted;
- }
+ } else
+ ++I;
}
return 0;
}