Hi!<br><br>I have a trouble - i can&#39;t run release build of Krita under valgrind (any tool). When i try to do it - it crashes with on the first stroke. The crash can be reproduced for valgrind&#39;ing several tests:<br>
./image/tests/KisAsyncMergerTest<br>./image/tests/KisUpdateSchedulerTest<br><br>All of them crash with the following output from valgrind: <a href="http://pastebin.com/73ufemy5">http://pastebin.com/73ufemy5</a><br>If i try to run krita itself -- the backtrace changes: <a href="http://pastebin.com/H1hfx9zy">http://pastebin.com/H1hfx9zy</a><br>
<br>Well, i don&#39;t know what to do with it, i tried every way i could...<br><br><br>How to reproduce:<br>1) Just compile krita in non-debug mode, that is: RelWithDebInfo or Release (In Debug it works fine without any crashes).<br>
2) And run tests under valgrind:<br>    valgrind KisAsyncMergerTest<br>    valgrind KisUpdateSchedulerTest<br><br>One observation:<br>There is some race condition, i think. But krita&#39;s threads seem to be innocent, because i tried to switch-off the pooler thread and run ./KisAsyncMerger test, that is single-threaded  - it crashes.<br>
How to prove, that there is a race: just add some delay into KoCompositeOpAlphaDarken.h and KoCompositeOpAlphaBase and the crash disappears, e.g.:<br><br>void composite(quint8 *dstRowStart,<br>                   qint32 dststride,<br>
                   const quint8 *srcRowStart,<br>                   qint32 srcstride,<br>                   const quint8 *maskRowStart,<br>                   qint32 maskstride,<br>                   qint32 rows,<br>                   qint32 cols,<br>
                   quint8 U8_opacity,<br>                   const QBitArray &amp; channelFlags) const {<br><br>        qint32 srcInc = (srcstride == 0) ? 0 : _CSTraits::channels_nb;<br><br>        channels_type opacity = KoColorSpaceMaths&lt;quint8, channels_type&gt;::scaleToA(U8_opacity);<br>
<br>        while (rows &gt; 0) {<br>            const channels_type *srcN = reinterpret_cast&lt;const channels_type *&gt;(srcRowStart);<br>            channels_type *dstN = reinterpret_cast&lt;channels_type *&gt;(dstRowStart);<br>
            const quint8 *mask = maskRowStart;<br><br>            qint32 columns = cols;<br><br><br>            //add this line or simple qDebug()<br>            usleep(500);<br><br>            ....<br>        }<br>}<br><br>
<br>Do you have any idea, what is this? Maybe, there is a bug in valgrind? If the latter is true, we need a reduction test, that shows this bug. Maybe i have some strange system packages?<br>If it runs fine on your system, could you send me your CMakeCache.txt and versions of gcc and valgrind?<br>
<br>-- <br>Dmitry Kazakov<br>