<div dir="ltr">Recompiling with <span style="font-family:arial,sans-serif;font-size:13px">TAGLIB_ATOMIC_GCC defined did the trick i think.. i'll have to do more testing but i havent been able to recreate the crash with that flag set so far.  I'll send another reply when i know for sure.  Thanks!</span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Oct 12, 2013 at 1:22 PM, Kyle <span dir="ltr"><<a href="mailto:gonemad@gmail.com" target="_blank">gonemad@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Yea I been looking at the ref/deref calls to possibly find a scenario when it could possibly hit 0 but couldnt find any.  Looking through the refcounter class i definitely did not compile with TAGLIB_ATOMIC_GCC on so it looks like its not truly atomic in what im running which might be the cause.. i'll have to see if the android NDK provides definitions for __sync_add_and_fetch and __sync_sub_and_fetch<div>


<br></div><div>That being said I think I am able to reproduce the crash if i just spawn 1000 threads running my scan code.. so if i can make refcounter atomic i can give it a try and see if that fixes things</div><div><br>

</div><div>Thanks</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Sat, Oct 12, 2013 at 1:04 PM, Michael Pyne <span dir="ltr"><<a href="mailto:mpyne@kde.org" target="_blank">mpyne@kde.org</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div>On Sat, October 12, 2013 11:41:33 Kyle wrote:<br>
> And I have many more similar but in different parts of taglib.  The only<br>
> common thing I can trace is the use of String::null.  The second trace i<br>
> posted happens in this chunk of code adding 2 static strings<br>
><br>
> String ID3v1::genre(int i)<br>
> {<br>
>   if(i >= 0 && i < genresSize)<br>
>     return genres[i] + String::null; // always make a copy<br>
>   return String::null;<br>
> }<br>
><br>
> Is there a possibility that String::null is somehow being deleted due to<br>
> some race condition?  I am using taglib in multiple threads at the same<br>
> time.  Any ideas?<br>
<br>
</div>I don't know about deleted, but String::null is still just a TagLib::String,<br>
so that means it acts like any other String.<br>
<br>
Specifically what that means is that functions which return String::null to<br>
fit a String return type may involve invoking the copy-constructor, which uses<br>
a RefCounter internally.<br>
<br>
It looks to me that RefCounter takes care to use atomic operations in a way<br>
that should be immune to race conditions, but it also has a portable, but racy<br>
mode of operation that might result in invalid ref counts. If String::null<br>
ever accidentally gets hit with a 0 ref count due to this it would delete<br>
itself.<br>
<br>
Does your Android-compiled TagLib have a real atomic RefCounter class (in<br>
taglib/toolkit/trefcounter.{h,cpp})?<br>
<br>
Regards,<br>
 - Michael Pyne<br></div></div>_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org" target="_blank">taglib-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/taglib-devel" target="_blank">https://mail.kde.org/mailman/listinfo/taglib-devel</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>-Kyle
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>-Kyle
</div>