Bug 331496 - crash while closing a polygonal selection
Summary: crash while closing a polygonal selection
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: 2.8 Beta
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-25 16:16 UTC by David REVOY
Modified: 2014-03-02 10:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
[ ^ crash log ] (10.52 KB, text/plain)
2014-02-25 16:16 UTC, David REVOY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David REVOY 2014-02-25 16:16:48 UTC
Created attachment 85326 [details]
[ ^ crash log ]

Hi,
I just had a '3 stars' crash while closing a polygonal selection. ( in attachment ) 
I'm still on 2.8 ; I just updated one hour ago after 10 days without updating it ( I was afraid of the commit concerning the preset curves, fortunately all is ok ).
Reproductible : no , I can't reproduce.
Comment 1 Halla Rempt 2014-02-26 11:41:11 UTC
This is a really weird backtrace...
Comment 2 Dmitry Kazakov 2014-02-26 12:27:45 UTC
<dmitryK> boud, ahiemstra: It might happen that this is a race condition: KisImage add a new node as a mask and UI requests the selection, which iterates through the nodes. But I can hardly imagine how it can be reproduced :(
<dmitryK> boud, ahiemstra: I might need to write a unittest for this theory
Comment 3 Halla Rempt 2014-02-27 11:04:43 UTC
Let's confirm then.
Comment 4 Dmitry Kazakov 2014-02-28 11:28:12 UTC
Yeah, the crash is reproducible in a simple unittest:

void KisSelectionDecorationTest::test()
{
    KisImageSP image = utils::createImage(0, QSize(3000, 3000));

    for (int i = 0; i < 10000; i++) {
        KisProcessingApplicator applicator(image,
                                           0 /* we need no automatic updates */,
                                           KisProcessingApplicator::SUPPORTS_WRAPAROUND_MODE,
                                           KisImageSignalVector() << ModifiedSignal,
                                           "test stroke");


        applicator.applyCommand(new KisSetEmptyGlobalSelectionCommand(image));
        applicator.applyCommand(new KisDeselectGlobalSelectionCommand(image));

        applicator.end();

        for (int j = 0; j < 100; j++) {
            KisSelectionSP selection = image->globalSelection();
        }
    }

    image->waitForDone();
}
Comment 5 Halla Rempt 2014-02-28 11:37:25 UTC
Interesting... Do you think the fix is just as simple?
Comment 6 Dmitry Kazakov 2014-02-28 14:32:35 UTC
Git commit 8aac6f2e46c848c6a3a51d80ffba160a45670909 by Dmitry Kazakov.
Committed on 28/02/2014 at 14:31.
Pushed by dkazakov into branch 'master'.

Added a bit more thread safety to KisNodeSP

Now one can read the content of a KisNode from an arbitrary number
of threads and at the same time write there with a single thread.
This is ensured by a read-write lock added to a KisNode. For details
see a comment in kis_node.cpp.

M  +100  -50   krita/image/kis_node.cpp
M  +6    -0    krita/ui/tests/CMakeLists.txt
A  +53   -0    krita/ui/tests/kis_selection_decoration_test.cpp     [License: GPL (v2+)]
A  +31   -0    krita/ui/tests/kis_selection_decoration_test.h     [License: GPL (v2+)]

http://commits.kde.org/calligra/8aac6f2e46c848c6a3a51d80ffba160a45670909
Comment 7 Dmitry Kazakov 2014-03-02 10:22:50 UTC
Git commit cef0f55ed4ae290fe1a068cff9b421ad13a32d97 by Dmitry Kazakov.
Committed on 28/02/2014 at 14:31.
Pushed by dkazakov into branch 'calligra/2.8'.

Added a bit more thread safety to KisNodeSP

Now one can read the content of a KisNode from an arbitrary number
of threads and at the same time write there with a single thread.
This is ensured by a read-write lock added to a KisNode. For details
see a comment in kis_node.cpp.

M  +100  -50   krita/image/kis_node.cpp
M  +6    -0    krita/ui/tests/CMakeLists.txt
A  +53   -0    krita/ui/tests/kis_selection_decoration_test.cpp     [License: GPL (v2+)]
A  +31   -0    krita/ui/tests/kis_selection_decoration_test.h     [License: GPL (v2+)]

http://commits.kde.org/calligra/cef0f55ed4ae290fe1a068cff9b421ad13a32d97