Hi all,

I read (everywhere) that a vector erase invalidates
all current iterators - see say -
 http://www.cplusplus.com/reference/stl/vector/erase/ 
so I really do not understand why genfans.cxx has lasted 
so long like it is ;=((

When it does a -
        tris.erase( t_current );
it should reset the iterators. The small patch attached 
does just that...

Maybe somehow, on some platforms, the iterators are
'correctly' adjusted, but certainly NOT in WIN32, and I
suspect the same in other platforms!

I would respectfully request the attached patch be 
applied soonest, unless there is some other reasoning 
at play here.

It certainly works better for me ;=)) And removes
another reason why fgfs-construct can abort
without apparent reason!

Regards,
Geoff.

patch:
diff -ur git\terragear-cs\src\Lib\Optimize\genfans.cxx local
\terragear-cs\src\Lib\Optimize\genfans.cxx
--- git\terragear-cs\src\Lib\Optimize\genfans.cxx       Sun Oct 10 10:13:00
2010
+++ local\terragear-cs\src\Lib\Optimize\genfans.cxx     Sat May 28 00:42:43
2011
@@ -213,6 +213,8 @@
        // add this fan to the fan list
        fans.push_back( node_list );
 
+    // restart on delete !!!
+Re_Start:
        // delete the triangles in best_fan out of tris and repeat
        triele_list_iterator t_current = tris.begin();
        triele_list_iterator t_last = tris.end();
@@ -226,6 +228,7 @@
                //      << " from master tri pool"
                //      << endl;
                tris.erase( t_current );
+        goto Re_Start;
            } else {
                ++t_current;
            }



------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to