Date: Sat, 6 Nov 2010 11:11:53 +0100 From: Vlad Galu <dudu@dudu.ro> To: Barbara <barbara.xxx1975@libero.it> Cc: freebsd-current@freebsd.org Subject: Re: libstc++ (?) problem on CURRENT? Message-ID: <AANLkTinn3O6pud1agZSfFSD1zzAJaYosjD4ze4cdBH=Z@mail.gmail.com> In-Reply-To: <19821003.923081289037424002.JavaMail.defaultUser@defaultHost> References: <19821003.923081289037424002.JavaMail.defaultUser@defaultHost>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Nov 6, 2010 at 10:57 AM, Barbara <barbara.xxx1975@libero.it> wrote: > > I had a problem running the IcedTea java plugin on CURRENT i386, while it > works on 8_STABLE. > But maybe it's not a problem related to the port. > Just to be clear, I'm not looking for a solution about the port here, I'm= just > wondering why the same c++ code is working on 8_STABLE and it's segfaulti= ng on > CURRENT, considering also that AFAIK the gcc version in both the base sys= tems > is the same. > > In the part of the code causing the crash, a std::map is read with an ite= rator > in a for loop, and if a condition is met, an entry is erased. > The following is the bt I'm getting: > #0 =A00x29e36247 in kill () from /lib/libc.so.7 > #1 =A00x29e361a6 in raise () from /lib/libc.so.7 > #2 =A00x282424f6 in XRE_LockProfileDirectory () from > =A0 =A0 =A0 =A0/usr/local/lib/firefox3/libxul.so > #3 =A0<signal handler called> > #4 =A00x29c8f1b2 in std::_Rb_tree_increment () from > =A0 =A0 =A0 =A0/usr/lib/libstdc++.so.6 #5 =A00x2ef92402 in > =A0 =A0 =A0 =A0IcedTeaPluginUtilities::invalidateInstance () from > =A0 =A0 =A0 =A0/usr/local/openjdk6/jre/lib/IcedTeaPlugin.so > ... > > I wrote a "patch" for the IcedTea plugin, replacing the for loop with a w= hile > and increasing the iterator before erasing from the map, and it seems wor= king. > Then I wrote a simple program that do something similar to IcedTea, so th= ere > is no need to build the whole java/openjdk6 port to do some testing. > Running it on 8_STABLE it works, on CURRENT it crashes. > You can find more details in this discussion on the freebsd-java ml: > http://lists.freebsd.org/pipermail/freebsd-java/2010-November/008978.html > > You can find the patch and the sample code in the discussion above, anywa= y I'm > reporting them here too: > icedtea patch: > http://pastebin.com/b2KKFNSG > test case: > http://pastebin.com/Amk4UJ0g You appear to invalidate the iterator inside the loop and then increment it. Do the following: -- cut here -- for (iter =3D cars.begin(); iter !=3D cars.end(); ) { if ((*iter).second =3D=3D modelName) cars.erase(iter++); else ++iter; } -- and here -- In this example, you first increment the iterator and then erase its previous value. --=20 Good, fast & cheap. Pick any two.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinn3O6pud1agZSfFSD1zzAJaYosjD4ze4cdBH=Z>
